File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Expand file tree Collapse file tree 4 files changed +15
-3
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.
77
88## Unreleased
99
10+ ### Added
11+
12+ - Better error messages from the derive macro stwhen the schema or the query file path is not found.
13+
1014## 0.5.0
1115
1216### Added
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ serde = "^1.0.78"
1717serde_derive = " 1.0"
1818serde_json = " 1.0"
1919heck = " 0.3"
20- graphql-parser = " 0.2.2 "
20+ graphql-parser = " = 0.2.0 "
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ repository = "https://github.com/graphql-rust/graphql-client"
1010proc-macro = true
1111
1212[dependencies ]
13+ failure = " 0.1"
1314syn = " 0.15"
1415proc-macro2 = { version = " 0.4" , features = [] }
1516graphql_client_codegen = { path = " ../graphql_client_codegen/" , version = " 0.5.0" }
Original file line number Diff line number Diff line change 1+ extern crate failure;
12extern crate graphql_client_codegen;
23extern crate proc_macro;
34extern crate proc_macro2;
45extern crate syn;
6+
7+ use failure:: ResultExt ;
58use graphql_client_codegen:: * ;
69
710use proc_macro2:: TokenStream ;
@@ -22,10 +25,14 @@ fn build_query_and_schema_path(
2225 let cargo_manifest_dir =
2326 :: std:: env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR env variable is defined" ) ;
2427
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 ( ) ;
2631 let query_path = format ! ( "{}/{}" , cargo_manifest_dir, query_path) ;
2732 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 ( ) ;
2936 let schema_path = :: std:: path:: Path :: new ( & cargo_manifest_dir) . join ( schema_path) ;
3037 ( query_path, schema_path)
3138}
You can’t perform that action at this time.
0 commit comments