Shun Miyazawa 3 years ago
parent
commit
1bffbf931b

+ 1 - 2
packages/app/src/components/PageRenameModal.tsx

@@ -11,7 +11,6 @@ import { debounce } from 'throttle-debounce';
 
 import { toastError } from '~/client/util/apiNotification';
 import { apiv3Get, apiv3Put } from '~/client/util/apiv3-client';
-import { isErrorV3 } from '~/interfaces/errors/v3-error';
 import { isIPageInfoForEntity } from '~/interfaces/page';
 import { useSiteUrl, useIsSearchServiceReachable } from '~/stores/context';
 import { usePageRenameModal } from '~/stores/modal';
@@ -140,7 +139,7 @@ const PageRenameModal = (): JSX.Element => {
     }
     catch (err) {
       // Do not toast in case of this error because debounce process may be executed after the renaming process is completed.
-      if (err.length === 1 && isErrorV3(err[0]) && err[0].code === 'from-page-is-not-exist') {
+      if (err.length === 1 && err[0].code === 'from-page-is-not-exist') {
         return;
       }
       setErrs(err);

+ 0 - 5
packages/app/src/interfaces/errors/v3-error.ts

@@ -1,8 +1,3 @@
 import { ErrorV3 } from '@growi/core';
 
 export type IErrorV3 = ErrorV3
-
-// type guard
-export const isErrorV3 = (args: any): args is IErrorV3 => {
-  return args.message != null;
-};

+ 1 - 1
packages/core/src/models/vo/error-apiv3.ts

@@ -1,6 +1,6 @@
 export class ErrorV3 extends Error {
 
-  code?: string;
+  code: string;
 
   args?: any;