Skip to content

Commit

Permalink
Merge pull request #11 from takker99/errors
Browse files Browse the repository at this point in the history
Add Error types
  • Loading branch information
takker99 authored Jan 4, 2022
2 parents 9a71056 + 098660a commit beb8de4
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions api/error.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
export type NotMemberError = {
/** Scrapbox REST APIが返すエラーの型 */
export interface ErrorLike {
/** error name */ name: string;
/** error message */ message: string;
}

/** 参加していないprivate projectに対してAPIを叩いたときに発生するエラー */
export interface NotMemberError extends ErrorLike {
name: "NotMemberError";
message: string;
};
}

export type NotFoundError = {
/** 指定したprojectやpageが見つからないときに発生するエラー */
export interface NotFoundError extends ErrorLike {
name: "NotFoundError";
message: string;
};
}

/** owner/admin権限が不足しているときに発生するエラー */
export interface NotPrivilegeError extends ErrorLike {
name: "NotPrivilegeError";
}

/** Loginが必要なAPIをloginせずに叩いたときに発生するエラー */
export interface NotLoggedInError extends ErrorLike {
name: "NotLoggedInError";
/** 詳細情報 */ details: {
/** 使用できるログイン方法 */ loginStrategies: (
| "google"
| "github"
| "microsoft"
| "gyazo"
| "email"
| "saml"
| "easy-trial"
)[];
};
}

0 comments on commit beb8de4

Please sign in to comment.