ruby-ambassador icon indicating copy to clipboard operation
ruby-ambassador copied to clipboard

Being able to supress exception raised on 404

Open asafblum opened this issue 8 years ago • 2 comments

when api returns 404 the base.rb raises a RecordNotFound exception probably return nil is a better return value for Ambassador::Find Call , when auto_create is 0 @chaselee what do you think ?

asafblum avatar May 25 '16 09:05 asafblum

Hey @asafblum! What do you think about passing an option in to the find method that flows through to call in base.rb to suppress the exceptions and instead just return response['errors']['error'] when there's a non-200 response? would that work here? is there a reason you don't want to catch the exception as a way of handling this case?

chaselee avatar May 25 '16 20:05 chaselee

@chaselee sounds very good to me. I think that 500 error should raise an error. but 404 is a valid response for searching at least in my case... tried to create a pull request but I was unable to run the rspec for some reason.

asafblum avatar May 26 '16 07:05 asafblum