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

assert break the contract, maybe provide another helper utils to response the error back to frontend? #363

Open
HelloRWA opened this issue Oct 9, 2024 · 0 comments

Comments

@HelloRWA
Copy link
Contributor

HelloRWA commented Oct 9, 2024

currently we use the assert

  assert(type(to) == 'string', "to is required!")

this will break the lua contract, and from frontend just get the error in a console format with color code, some kind like this:

in function '.process.handle'\u001b[0m\n\n\u001b[31merror:\n\u001b[0m[string \".handlers\"]:559: [string \"aos\"]:138: to is required!"

Screenshot 2024-10-09 at 16 08 58

maybe we can have another field like rawError and can append into the response for frontend?

{
    ... the same as old output response,
   "rawError": "to is requred!"
}
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

1 participant