File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,18 @@ def not_found
3838 raise CloudController ::Errors ::NotFound . new_from_details ( 'NotFound' )
3939 end
4040
41- def db_connection_error
42- raise Sequel :: DatabaseConnectionError . new
41+ def decryption_error
42+ raise OpenSSL :: Cipher :: CipherError . new
4343 end
4444
4545 def db_disconnect_error
4646 raise Sequel ::DatabaseDisconnectError . new
4747 end
4848
49+ def db_connection_error
50+ raise Sequel ::DatabaseConnectionError . new
51+ end
52+
4953 def warnings_is_nil
5054 add_warning_headers ( nil )
5155 render status : :ok , json : { }
@@ -320,6 +324,23 @@ def warnings_incorrect_type
320324 end
321325 end
322326
327+ describe '#handle_decryption_error' do
328+ let! ( :user ) { set_current_user ( VCAP ::CloudController ::User . make ) }
329+
330+ before do
331+ allow_any_instance_of ( ErrorPresenter ) . to receive ( :raise_500? ) . and_return ( false )
332+ routes . draw do
333+ get 'decryption_error' => 'anonymous#decryption_error'
334+ end
335+ end
336+
337+ it 'rescues from OpenSSL::Cipher::CipherError and renders an error presenter1' do
338+ get :decryption_error
339+ expect ( response ) . to have_http_status ( :internal_server_error )
340+ expect ( response ) . to have_error_message ( /Failed to decrypt credentials/ )
341+ end
342+ end
343+
323344 describe '#add_warning_headers' do
324345 let! ( :user ) { set_current_user ( VCAP ::CloudController ::User . make ) }
325346
You can’t perform that action at this time.
0 commit comments