@@ -116,32 +116,34 @@ pub async fn subgraph_queries(
116116 } ;
117117
118118 match server. query_processor . execute_paid_query ( paid_query) . await {
119- Ok ( res) if res . status == 200 => {
119+ Ok ( res) => {
120120 query_duration_timer. observe_duration ( ) ;
121121 metrics:: SUCCESSFUL_QUERIES
122122 . with_label_values ( & [ & deployment_label] )
123123 . inc ( ) ;
124124 ( StatusCode :: OK , Json ( res. result ) ) . into_response ( )
125125 }
126- _ => {
126+ Err ( e ) => {
127127 metrics:: FAILED_QUERIES
128128 . with_label_values ( & [ & deployment_label] )
129129 . inc ( ) ;
130- IndexerError :: new (
131- IndexerErrorCode :: IE032 ,
132- Some ( IndexerErrorCause :: new (
133- "Failed to execute a paid subgraph query to graph node" ,
134- ) ) ,
130+ let err_msg = format ! (
131+ "Failed to execute a paid subgraph query to graph node: {}" ,
132+ e
135133 ) ;
136- return bad_request_response ( "Failed to execute paid query" ) ;
134+ IndexerError :: new ( IndexerErrorCode :: IE032 , Some ( IndexerErrorCause :: new ( e) ) ) ;
135+ return bad_request_response ( & err_msg) ;
137136 }
138137 }
139138 } else {
140- // TODO: emit IndexerErrorCode::IE030 on missing receipt
141139 let error_body = "Query request header missing scalar-receipts or incorrect auth token" ;
142140 metrics:: QUERIES_WITHOUT_RECEIPT
143141 . with_label_values ( & [ & deployment_label] )
144142 . inc ( ) ;
143+ IndexerError :: new (
144+ IndexerErrorCode :: IE030 ,
145+ Some ( IndexerErrorCause :: new ( error_body) ) ,
146+ ) ;
145147 query_duration_timer. observe_duration ( ) ;
146148 bad_request_response ( error_body)
147149 }
0 commit comments