-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from takker99/errors
Add Error types
- Loading branch information
Showing
1 changed file
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
)[]; | ||
}; | ||
} |