brillout / wildcard-api

Functions as API.
MIT License
368 stars 14 forks source link

Improve usage warning format #57

Closed brillout closed 4 years ago

brillout commented 4 years ago

As discussed with @lostpebble, usage warnings shouldn't have a custom format, but should be "classical" Nodejs exceptions.

Same for internal errors.

Also, all warning/error messages should be one-liners (albeit potentially very long one liners).

brillout commented 4 years ago

:heavy_check_mark: Test infra is ready to assert stdout and stderr. :heavy_check_mark: stdout is tested - no stdout spam guaranteed.

Changing the format in itself will/should be easy.

brillout commented 4 years ago

cc @lostpebble

:heavy_check_mark: Core is now TS typed. :heavy_check_mark: Code is more readable/cleaner (still far from perfect, but better than before) :heavy_check_mark: Redesigned some important aspects of error handling. It's simpler now. :heavy_check_mark: Reworded all error/warning messages. :heavy_check_mark: Wildcard will always return an HTTP response, never throw, and do a single console.error for usage errors. Among others, this means that a frontend can now always gracefully handle errors. (The exception being if Wildcard has a bug then it will actually throw.) Wildcard does throw instead of console.error when doing SSR. :heavy_check_mark: The error/warning messages are now tested against. :heavy_check_mark: All error/warning messages have a "normal" format: a stack trace and a single-line err.message. All unit tests are verified against this. No more stdout/stderr spam. :heavy_check_mark: Around 50% more tests to catch more error handling and edge cases (everything is not covered yet but getting close to it). :heavy_check_mark: It's now import { server } from '@wildcard-api/server'; instead of import { endpoints }.

That's on top of my head.

It's published as 0.4.0 but it still contains the donation-reminder GCE bug. I'll let you now once I've published a minor that fixes this.

I'm going to rename Wildcard API to telefunc. I want to get away from all API terminology. Going to talk about telefunctions instead of endpoints.

FYI, I've developed a full vision for telefunc. It's going to be insane...

  1. Fully managed and dead-simple session/auth management. Design is pretty stable.
  2. Simple realtime comm. Design could still have leaks, but I don't think so AFAICT.
  3. Independent but works-well-with-telefunc project tackling this long-standing nasty problem of schema queries, basically like GraphQL but 10x simpler, on all sides: much much simpler resolvers, simpler queries, simpler permissions. No unnecessary DSL, everything is JSON, hence compatible with telefunc.

But for now I'm heads down on the Lsos.

brillout commented 4 years ago

Migration path: https://github.com/reframejs/wildcard-api/releases/tag/v0.4.0 - should remain the same after the GCE bugfix.

brillout commented 4 years ago

@lostpebble

Some new little breaking changes: https://github.com/reframejs/wildcard-api/releases/tag/v0.5.0

Note the argumentsAlwaysInHttpBody rename to shortUrl.

I will publish a GCE bugfix in 0.5.1 soon