File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
8
8
## Unreleased
9
9
10
+ ### Added
11
+
12
+ - Better error messages from the derive macro stwhen the schema or the query file path is not found.
13
+
10
14
## 0.5.0
11
15
12
16
### Added
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ repository = "https://github.com/graphql-rust/graphql-client"
10
10
proc-macro = true
11
11
12
12
[dependencies ]
13
+ failure = " 0.1"
13
14
syn = " 0.15"
14
15
proc-macro2 = { version = " 0.4" , features = [] }
15
16
graphql_client_codegen = { path = " ../graphql_client_codegen/" , version = " 0.5.0" }
Original file line number Diff line number Diff line change
1
+ extern crate failure;
1
2
extern crate graphql_client_codegen;
2
3
extern crate proc_macro;
3
4
extern crate proc_macro2;
4
5
extern crate syn;
6
+
7
+ use failure:: ResultExt ;
5
8
use graphql_client_codegen:: * ;
6
9
7
10
use proc_macro2:: TokenStream ;
@@ -22,10 +25,14 @@ fn build_query_and_schema_path(
22
25
let cargo_manifest_dir =
23
26
:: std:: env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR env variable is defined" ) ;
24
27
25
- let query_path = attributes:: extract_attr ( input, "query_path" ) . unwrap ( ) ;
28
+ let query_path = attributes:: extract_attr ( input, "query_path" )
29
+ . context ( "Extracting query path" )
30
+ . unwrap ( ) ;
26
31
let query_path = format ! ( "{}/{}" , cargo_manifest_dir, query_path) ;
27
32
let query_path = :: std:: path:: Path :: new ( & query_path) . to_path_buf ( ) ;
28
- let schema_path = attributes:: extract_attr ( input, "schema_path" ) . unwrap ( ) ;
33
+ let schema_path = attributes:: extract_attr ( input, "schema_path" )
34
+ . context ( "Extracting schema path" )
35
+ . unwrap ( ) ;
29
36
let schema_path = :: std:: path:: Path :: new ( & cargo_manifest_dir) . join ( schema_path) ;
30
37
( query_path, schema_path)
31
38
}
You can’t perform that action at this time.
0 commit comments