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

Emit an error trace when a URL argument is not defined, or allow users to handle it #635

Open
apoliakov opened this issue Oct 2, 2024 · 1 comment

Comments

@apoliakov
Copy link
Member

apoliakov commented Oct 2, 2024

A user has a handler like this:

  @GetApi('/ticket/:number')
  static async ticketHandler(_ctxt: HandlerContext, @ArgSource(ArgSources.URL)  number: string) {
    return 'Hello ' + number;
  }

The problem is that, when the number is not provided, (the caller visits app/ticket/) the caller gets a Not Found but no ERROR trace is emitted and the event does not show up in the dashboard. We'd like the event to be observed (or give the user some means to handle it themselves).

This makes debugging difficult - users can't tell from the dashboard that the client is visiting the wrong route.

I tried various combinations with @ArgOptional but couldn't find one that gives us the desired behavior with the URL argument.

@demetris-manikas
Copy link
Contributor

The route /ticket/ is equivalent to /ticket and not /ticket/[empty] and the there is no registration for such a route (therefore the 404).
In a well defined REST api the '/ticket/' route should be defined.

Adding default handlers for such cases would probably be a novelty,
so I would not consider this an issue. for me this is just default routing behaviour.

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