Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved the error handling. #9

Merged
merged 1 commit into from
Sep 21, 2020
Merged

Improved the error handling. #9

merged 1 commit into from
Sep 21, 2020

Conversation

Jack12816
Copy link
Member

@Jack12816 Jack12816 commented Sep 21, 2020

When an error occurred deep in the called factory the API endpoint responded something like this:

ActionView::MissingTemplate:
  Missing template factory_bot/instrumentation/root/create,
  factory_bot/instrumentation/application/create with {:locale=>[:en],
  :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder,
  :ruby]}. Searched in:
    * "/app/spec/dummy/app/views"
    * "/app/app/views"      

Now the error handling can be customized and the default error response looks like this:
(HTTP status code: 500)

{
  "application": "Name of your Application",
  "error": "Factory not registered: \"admin\"", 
  "backtrace": "[..]"
}

@Jack12816 Jack12816 added the Review Requested The pull request was implemented and is ready for a review label Sep 21, 2020
@Jack12816 Jack12816 self-assigned this Sep 21, 2020
Signed-off-by: Hermann Mayer <hermann.mayer92@gmail.com>
@Jack12816 Jack12816 force-pushed the better-error-handling branch from 3a5689f to 679456f Compare September 21, 2020 10:41
@Jack12816 Jack12816 merged commit b9a82cc into master Sep 21, 2020
@Jack12816 Jack12816 deleted the better-error-handling branch September 21, 2020 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review Requested The pull request was implemented and is ready for a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants