-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure error outputs are what we expect (#114)
I've added a `--verify` mode to `tutorial_generator`: expected error outputs are now committed to `.git` and we verify, in CI, that the auto-generated ones match what we expect. This ensures that we never see again a regression like the one we fixed in #113: the step was failing as expected but with a completely different error from the one we wanted.
- Loading branch information
1 parent
2680be5
commit c05c3f0
Showing
10 changed files
with
371 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
!*.snap | ||
!*.patch | ||
!tutorial.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ERROR: | ||
× I can't invoke your request handler, `demo::routes::greet::greet`, because it needs an | ||
│ instance of `demo::user_agent::UserAgent` as input, but I can't find a constructor for that | ||
│ type. | ||
│ | ||
│ ╭─[demo/src/blueprint.rs:14:1] | ||
│ 14 │ bp.route(GET, "/api/ping", f!(crate::routes::status::ping)); | ||
│ 15 │ bp.route(GET, "/api/greet/:name", f!(crate::routes::greet::greet)); | ||
│ · ───────────────┬─────────────── | ||
│ · ╰── The request handler was registered here | ||
│ 16 │ bp | ||
│ ╰──── | ||
│ ╭─[demo/src/routes/greet.rs:13:1] | ||
│ 13 │ | ||
│ 14 │ pub fn greet(params: RouteParams<GreetParams>, user_agent: UserAgent) -> Response { | ||
│ · ────┬──── | ||
│ · ╰── I don't know how to construct an instance of this input parameter | ||
│ 15 │ if let UserAgent::Unknown = user_agent { | ||
│ ╰──── | ||
│ help: Register a constructor for `demo::user_agent::UserAgent` | ||
|
||
Error: `pavex_cli` exited with a non-zero status code: 1 | ||
error: Failed to run `bp`, the code generator for package `demo_server_sdk` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ERROR: | ||
× You registered a constructor that returns a `Result`, but you did not register an error | ||
│ handler for it. If I don't have an error handler, I don't know what to do with the error when | ||
│ the constructor fails! | ||
│ | ||
│ ╭─[demo/src/blueprint.rs:12:1] | ||
│ 12 │ bp.constructor( | ||
│ 13 │ f!(crate::user_agent::UserAgent::extract), | ||
│ · ────────────────────┬──────────────────── | ||
│ · ╰── The fallible constructor was registered here | ||
│ 14 │ Lifecycle::RequestScoped, | ||
│ ╰──── | ||
│ help: Add an error handler via `.error_handler` | ||
|
||
Error: `pavex_cli` exited with a non-zero status code: 1 | ||
error: Failed to run `bp`, the code generator for package `demo_server_sdk` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.