Преглед на файлове

feat(exam): add protection when calling inspection/start during body position switch, prompt user for non-zero return codes

sw преди 1 месец
родител
ревизия
adf50e8149
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      src/API/exam/changeBodyPosition.ts

+ 7 - 0
src/API/exam/changeBodyPosition.ts

@@ -4,5 +4,12 @@ export const changeBodyPosition = async (instanceUid: string) => {
   const response = await axiosInstance.post(`auth/task/inspection/start`, {
     instance_uid: instanceUid,
   });
+
+  if (response.data.code !== '0' && response.data.code !== '0x020101') {
+    throw new Error(
+      `Error code: ${response.data.code}, Description: ${response.data.description}`
+    );
+  }
+
   return response.data;
 };