From 74830a4f503aecf5e2197951d8e5d46d985f2844 Mon Sep 17 00:00:00 2001 From: boxbeam Date: Tue, 23 Jan 2024 11:55:44 -0500 Subject: [PATCH] fix(webserver): Return standard error code for unauthorized graphql access (#1279) * fix(webserver): Return standard error code for unauthorized graphql access * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- ee/tabby-webserver/src/schema/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ee/tabby-webserver/src/schema/mod.rs b/ee/tabby-webserver/src/schema/mod.rs index 731194b2c04a..df6b12e9a510 100644 --- a/ee/tabby-webserver/src/schema/mod.rs +++ b/ee/tabby-webserver/src/schema/mod.rs @@ -71,7 +71,9 @@ pub enum CoreError { impl IntoFieldError for CoreError { fn into_field_error(self) -> FieldError { match self { - Self::Unauthorized(msg) => FieldError::new(msg, graphql_value!("Unauthorized")), + Self::Unauthorized(msg) => { + FieldError::new(msg, graphql_value!({"code": "UNAUTHORIZED"})) + } _ => self.into(), } }