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

How do I customize error code when using responder()->error()->respond? #151

Open
aligajani opened this issue Jan 16, 2020 · 1 comment
Open

Comments

@aligajani
Copy link

Hey dude, great package. Would love to customize the error code when doing:

responder()->error('email_taken', 'The email is already taken')->respond();

so it doesn't always return error=500 by default. Also, not ideal to create an exception.

{"status":500,"success":false,"error":{"code":"email_taken","message":"The email is already taken"}}

Surely there is a simpler way. Any tips?

@aligajani aligajani changed the title How do I customize error code in when using responder()->error()->respond? How do I customize error code when using responder()->error()->respond? Jan 16, 2020
@Hesesses
Copy link

you can specify the error code like ->respond(400)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants