initial commit
This commit is contained in:
27
fluxer_api/src/errors/AccessDeniedError.ts
Normal file
27
fluxer_api/src/errors/AccessDeniedError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class AccessDeniedError extends FluxerAPIError {
|
||||
constructor(message = 'Access denied') {
|
||||
super({code: APIErrorCodes.ACCESS_DENIED, message, status: 403});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/AccountSuspiciousActivityError.ts
Normal file
35
fluxer_api/src/errors/AccountSuspiciousActivityError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class AccountSuspiciousActivityError extends ForbiddenError {
|
||||
constructor(suspiciousActivityFlags: number) {
|
||||
super({
|
||||
code: APIErrorCodes.ACCOUNT_SUSPICIOUS_ACTIVITY,
|
||||
message: 'Your account has been flagged for suspicious activity. Please verify your identity to continue.',
|
||||
data: {
|
||||
data: {
|
||||
suspicious_activity_flags: suspiciousActivityFlags,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/AclsMustBeNonEmptyError.ts
Normal file
27
fluxer_api/src/errors/AclsMustBeNonEmptyError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class AclsMustBeNonEmptyError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.ACLS_MUST_BE_NON_EMPTY, message: 'ACLs must be non-empty strings'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/AlreadyFriendsError.ts
Normal file
30
fluxer_api/src/errors/AlreadyFriendsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class AlreadyFriendsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.ALREADY_FRIENDS,
|
||||
message: 'You are already friends with this user',
|
||||
});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/ApplicationNotFoundError.ts
Normal file
35
fluxer_api/src/errors/ApplicationNotFoundError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {FluxerErrorData} from './FluxerAPIError';
|
||||
import {NotFoundError} from './NotFoundError';
|
||||
|
||||
export class ApplicationNotFoundError extends NotFoundError {
|
||||
constructor({
|
||||
message = 'Application not found',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
} = {}) {
|
||||
super({code: 'APPLICATION_NOT_FOUND', message, data, headers});
|
||||
}
|
||||
}
|
||||
31
fluxer_api/src/errors/AuditLogIndexingError.ts
Normal file
31
fluxer_api/src/errors/AuditLogIndexingError.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class AuditLogIndexingError extends FluxerAPIError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.AUDIT_LOG_INDEXING,
|
||||
message: 'Guild audit logs are being indexed. Please try again shortly.',
|
||||
status: 202,
|
||||
});
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/BadRequestError.ts
Normal file
36
fluxer_api/src/errors/BadRequestError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {FluxerAPIError, type FluxerErrorData} from './FluxerAPIError';
|
||||
|
||||
export class BadRequestError extends FluxerAPIError {
|
||||
constructor({
|
||||
code,
|
||||
message = 'Bad Request',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
code: string;
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
}) {
|
||||
super({code, message, status: 400, data, headers});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/BannedFromGuildError.ts
Normal file
27
fluxer_api/src/errors/BannedFromGuildError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class BannedFromGuildError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.USER_BANNED_FROM_GUILD, message: 'You are banned from this guild.'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/BetaCodeAllowanceExceededError.ts
Normal file
30
fluxer_api/src/errors/BetaCodeAllowanceExceededError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class BetaCodeAllowanceExceededError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_BETA_CODES_REACHED,
|
||||
message: 'You have used your weekly allowance of 3 beta codes. Please wait until next week.',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/BetaCodeMaxUnclaimedError.ts
Normal file
30
fluxer_api/src/errors/BetaCodeMaxUnclaimedError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class BetaCodeMaxUnclaimedError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_BETA_CODES_REACHED,
|
||||
message: 'You have reached the maximum limit of 6 unclaimed beta codes',
|
||||
});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/BotAlreadyInGuildError.ts
Normal file
35
fluxer_api/src/errors/BotAlreadyInGuildError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
import type {FluxerErrorData} from './FluxerAPIError';
|
||||
|
||||
export class BotAlreadyInGuildError extends BadRequestError {
|
||||
constructor({
|
||||
message = 'Bot is already in this guild',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
} = {}) {
|
||||
super({code: 'BOT_ALREADY_IN_GUILD', message, data, headers});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/BotApplicationNotFoundError.ts
Normal file
35
fluxer_api/src/errors/BotApplicationNotFoundError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {FluxerErrorData} from './FluxerAPIError';
|
||||
import {NotFoundError} from './NotFoundError';
|
||||
|
||||
export class BotApplicationNotFoundError extends NotFoundError {
|
||||
constructor({
|
||||
message = 'Bot application not found',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
} = {}) {
|
||||
super({code: 'BOT_APPLICATION_NOT_FOUND', message, data, headers});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/BotIsPrivateError.ts
Normal file
35
fluxer_api/src/errors/BotIsPrivateError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {FluxerErrorData} from './FluxerAPIError';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class BotIsPrivateError extends ForbiddenError {
|
||||
constructor({
|
||||
message = 'This bot is private and can only be invited by the owner',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
} = {}) {
|
||||
super({code: 'BOT_IS_PRIVATE', message, data, headers});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/BotUserNotFoundError.ts
Normal file
35
fluxer_api/src/errors/BotUserNotFoundError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {FluxerErrorData} from './FluxerAPIError';
|
||||
import {NotFoundError} from './NotFoundError';
|
||||
|
||||
export class BotUserNotFoundError extends NotFoundError {
|
||||
constructor({
|
||||
message = 'Bot user not found',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
} = {}) {
|
||||
super({code: 'BOT_USER_NOT_FOUND', message, data, headers});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/BotsCannotHaveFriendsError.ts
Normal file
30
fluxer_api/src/errors/BotsCannotHaveFriendsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class BotsCannotHaveFriendsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.BOTS_CANNOT_HAVE_FRIENDS,
|
||||
message: 'Bots cannot have friends',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CallAlreadyExistsError.ts
Normal file
30
fluxer_api/src/errors/CallAlreadyExistsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CallAlreadyExistsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CALL_ALREADY_EXISTS,
|
||||
message: 'A call already exists in this channel',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotEditOtherUserMessageError.ts
Normal file
30
fluxer_api/src/errors/CannotEditOtherUserMessageError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class CannotEditOtherUserMessageError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_EDIT_OTHER_USER_MESSAGE,
|
||||
message: 'Cannot edit message authored by other user.',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CannotEditSystemMessageError.ts
Normal file
27
fluxer_api/src/errors/CannotEditSystemMessageError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotEditSystemMessageError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.CANNOT_MODIFY_SYSTEM_WEBHOOK, message: 'Cannot edit system message.'});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CannotExecuteOnDmError.ts
Normal file
27
fluxer_api/src/errors/CannotExecuteOnDmError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotExecuteOnDmError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.CANNOT_EXECUTE_ON_DM, message: 'Cannot execute this action on a DM channel.'});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotRedeemPlutoniumWithVisionaryError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_REDEEM_PLUTONIUM_WITH_VISIONARY,
|
||||
message: 'Cannot redeem Plutonium gift codes while you have Visionary premium',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CannotRemoveOtherRecipientsError.ts
Normal file
27
fluxer_api/src/errors/CannotRemoveOtherRecipientsError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class CannotRemoveOtherRecipientsError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.MISSING_PERMISSIONS, message: 'Only the owner can remove other recipients'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotReportOwnGuildError.ts
Normal file
30
fluxer_api/src/errors/CannotReportOwnGuildError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotReportOwnGuildError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_REPORT_OWN_GUILD,
|
||||
message: 'Cannot report your own guild',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotReportOwnMessageError.ts
Normal file
30
fluxer_api/src/errors/CannotReportOwnMessageError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotReportOwnMessageError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_REPORT_OWN_MESSAGE,
|
||||
message: 'Cannot report your own message',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotReportYourselfError.ts
Normal file
30
fluxer_api/src/errors/CannotReportYourselfError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotReportYourselfError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_REPORT_YOURSELF,
|
||||
message: 'Cannot report yourself',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CannotSendEmptyMessageError.ts
Normal file
27
fluxer_api/src/errors/CannotSendEmptyMessageError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotSendEmptyMessageError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.CANNOT_SEND_EMPTY_MESSAGE, message: 'Cannot send empty message.'});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotSendFriendRequestToBlockedUserError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_SEND_FRIEND_REQUEST_TO_BLOCKED_USER,
|
||||
message: 'You must unblock this user before sending a friend request',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotSendFriendRequestToSelfError.ts
Normal file
30
fluxer_api/src/errors/CannotSendFriendRequestToSelfError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotSendFriendRequestToSelfError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_SEND_FRIEND_REQUEST_TO_SELF,
|
||||
message: 'Cannot send friend request to yourself',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotSendMessageToNonTextChannelError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL,
|
||||
message: 'Cannot send message to non-text channel.',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CannotSendMessagesToUserError.ts
Normal file
27
fluxer_api/src/errors/CannotSendMessagesToUserError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotSendMessagesToUserError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.CANNOT_SEND_MESSAGES_TO_USER, message: 'Cannot send messages to this user'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CannotShrinkReservedSlotsError.ts
Normal file
30
fluxer_api/src/errors/CannotShrinkReservedSlotsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CannotShrinkReservedSlotsError extends BadRequestError {
|
||||
constructor(reservedSlotIndices: Array<number>) {
|
||||
super({
|
||||
code: APIErrorCodes.CANNOT_SHRINK_RESERVED_SLOTS,
|
||||
message: `Cannot shrink slots: ${reservedSlotIndices.length} slot(s) at indices [${reservedSlotIndices.join(', ')}] are currently reserved`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CaptchaVerificationRequiredError.ts
Normal file
30
fluxer_api/src/errors/CaptchaVerificationRequiredError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class CaptchaVerificationRequiredError extends BadRequestError {
|
||||
constructor(message: string = 'Captcha verification required') {
|
||||
super({
|
||||
code: APIErrorCodes.CAPTCHA_REQUIRED,
|
||||
message,
|
||||
});
|
||||
}
|
||||
}
|
||||
31
fluxer_api/src/errors/ChannelIndexingError.ts
Normal file
31
fluxer_api/src/errors/ChannelIndexingError.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class ChannelIndexingError extends FluxerAPIError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.CHANNEL_INDEXING,
|
||||
message: 'Channel is being indexed. Please try again later.',
|
||||
status: 202,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/CommunicationDisabledError.ts
Normal file
30
fluxer_api/src/errors/CommunicationDisabledError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class CommunicationDisabledError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.COMMUNICATION_DISABLED,
|
||||
message: 'Communication disabled while timed out',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/CreationFailedError.ts
Normal file
27
fluxer_api/src/errors/CreationFailedError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {InternalServerError} from './InternalServerError';
|
||||
|
||||
export class CreationFailedError extends InternalServerError {
|
||||
constructor(message: string) {
|
||||
super({code: APIErrorCodes.CREATION_FAILED, message});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/DeletionFailedError.ts
Normal file
27
fluxer_api/src/errors/DeletionFailedError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {InternalServerError} from './InternalServerError';
|
||||
|
||||
export class DeletionFailedError extends InternalServerError {
|
||||
constructor(message: string) {
|
||||
super({code: APIErrorCodes.DELETION_FAILED, message});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/EmailServiceNotTestableError.ts
Normal file
27
fluxer_api/src/errors/EmailServiceNotTestableError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {InternalServerError} from './InternalServerError';
|
||||
|
||||
export class EmailServiceNotTestableError extends InternalServerError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.EMAIL_SERVICE_NOT_TESTABLE, message: 'Email service does not support test inspection'});
|
||||
}
|
||||
}
|
||||
67
fluxer_api/src/errors/ErrorHandlers.ts
Normal file
67
fluxer_api/src/errors/ErrorHandlers.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import * as Sentry from '@sentry/node';
|
||||
import type {ErrorHandler, NotFoundHandler} from 'hono';
|
||||
import {HTTPException} from 'hono/http-exception';
|
||||
import type {HonoEnv} from '~/App';
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {Logger} from '~/Logger';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export const AppErrorHandler: ErrorHandler<HonoEnv> = (err) => {
|
||||
const isExpectedError = err instanceof Error && 'isExpected' in err && err.isExpected;
|
||||
|
||||
if (!(err instanceof FluxerAPIError || isExpectedError)) {
|
||||
Sentry.captureException(err);
|
||||
}
|
||||
|
||||
if (err instanceof FluxerAPIError) {
|
||||
return err.getResponse();
|
||||
}
|
||||
if (err instanceof HTTPException) {
|
||||
return new Response(JSON.stringify({code: APIErrorCodes.GENERAL_ERROR, message: err.message}), {
|
||||
status: err.status,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
});
|
||||
}
|
||||
if (isExpectedError) {
|
||||
Logger.warn({err}, 'Expected error occurred');
|
||||
return new Response(JSON.stringify({code: APIErrorCodes.GENERAL_ERROR, message: err.message}), {
|
||||
status: 400,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
});
|
||||
}
|
||||
Logger.error({err}, 'Unhandled error occurred');
|
||||
const error = new FluxerAPIError({
|
||||
code: APIErrorCodes.GENERAL_ERROR,
|
||||
message: 'An internal server error occurred.',
|
||||
status: 500,
|
||||
});
|
||||
return error.getResponse();
|
||||
};
|
||||
|
||||
export const AppNotFoundHandler: NotFoundHandler<HonoEnv> = () => {
|
||||
const error = new FluxerAPIError({
|
||||
code: APIErrorCodes.GENERAL_ERROR,
|
||||
message: 'The requested endpoint does not exist.',
|
||||
status: 404,
|
||||
});
|
||||
return error.getResponse();
|
||||
};
|
||||
31
fluxer_api/src/errors/ExplicitContentCannotBeSentError.ts
Normal file
31
fluxer_api/src/errors/ExplicitContentCannotBeSentError.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class ExplicitContentCannotBeSentError extends BadRequestError {
|
||||
constructor(probability: number, predictions: Record<string, number>) {
|
||||
super({
|
||||
code: APIErrorCodes.EXPLICIT_CONTENT_CANNOT_BE_SENT,
|
||||
message: `Explicit content cannot be sent in this context (${(probability * 100).toFixed(1)}% probability)`,
|
||||
data: {probability, predictions},
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/FeatureTemporarilyDisabledError.ts
Normal file
27
fluxer_api/src/errors/FeatureTemporarilyDisabledError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class FeatureTemporarilyDisabledError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.FEATURE_TEMPORARILY_DISABLED, message: 'This feature is temporarily disabled'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/FileSizeTooLargeError.ts
Normal file
30
fluxer_api/src/errors/FileSizeTooLargeError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class FileSizeTooLargeError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.FILE_SIZE_TOO_LARGE,
|
||||
message: 'File size too large',
|
||||
});
|
||||
}
|
||||
}
|
||||
71
fluxer_api/src/errors/FluxerAPIError.ts
Normal file
71
fluxer_api/src/errors/FluxerAPIError.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {HTTPException} from 'hono/http-exception';
|
||||
|
||||
type ErrorStatusCode = 202 | 400 | 401 | 403 | 404 | 423 | 429 | 500;
|
||||
|
||||
export type FluxerErrorData = Record<string, unknown>;
|
||||
|
||||
export class FluxerAPIError extends HTTPException {
|
||||
code: string;
|
||||
override message: string;
|
||||
override status: ErrorStatusCode;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
|
||||
constructor({
|
||||
code,
|
||||
message,
|
||||
status,
|
||||
data,
|
||||
headers,
|
||||
}: {
|
||||
code: string;
|
||||
message: string;
|
||||
status: ErrorStatusCode;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
}) {
|
||||
super(status, {message});
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.status = status;
|
||||
this.data = data;
|
||||
this.headers = headers;
|
||||
this.name = 'FluxerAPIError';
|
||||
}
|
||||
|
||||
override getResponse(): Response {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
code: this.code,
|
||||
message: this.message,
|
||||
...this.data,
|
||||
}),
|
||||
{
|
||||
status: this.status,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...this.headers,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/ForbiddenError.ts
Normal file
36
fluxer_api/src/errors/ForbiddenError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {FluxerAPIError, type FluxerErrorData} from './FluxerAPIError';
|
||||
|
||||
export class ForbiddenError extends FluxerAPIError {
|
||||
constructor({
|
||||
code,
|
||||
message = 'Forbidden',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
code: string;
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
}) {
|
||||
super({code, message, status: 403, data, headers});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/FriendRequestBlockedError.ts
Normal file
30
fluxer_api/src/errors/FriendRequestBlockedError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class FriendRequestBlockedError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.FRIEND_REQUEST_BLOCKED,
|
||||
message: 'This user is not accepting friend requests from you',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/GiftCodeAlreadyRedeemedError.ts
Normal file
30
fluxer_api/src/errors/GiftCodeAlreadyRedeemedError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class GiftCodeAlreadyRedeemedError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.GIFT_CODE_ALREADY_REDEEMED,
|
||||
message: 'This gift code has already been redeemed',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class GuildDisallowsUnclaimedAccountsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.GUILD_DISALLOWS_UNCLAIMED_ACCOUNTS,
|
||||
message: 'This community does not allow unclaimed accounts to join',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/GuildVerificationRequiredError.ts
Normal file
27
fluxer_api/src/errors/GuildVerificationRequiredError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class GuildVerificationRequiredError extends ForbiddenError {
|
||||
constructor(message: string) {
|
||||
super({code: APIErrorCodes.GUILD_VERIFICATION_REQUIRED, message});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/HarvestExpiredError.ts
Normal file
30
fluxer_api/src/errors/HarvestExpiredError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class HarvestExpiredError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.HARVEST_EXPIRED,
|
||||
message: 'Data harvest has expired and is no longer available for download',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/HarvestFailedError.ts
Normal file
27
fluxer_api/src/errors/HarvestFailedError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class HarvestFailedError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.HARVEST_FAILED, message: 'Data harvest failed'});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/HarvestNotReadyError.ts
Normal file
27
fluxer_api/src/errors/HarvestNotReadyError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class HarvestNotReadyError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.HARVEST_NOT_READY, message: 'Data harvest is not yet complete'});
|
||||
}
|
||||
}
|
||||
38
fluxer_api/src/errors/HarvestOnCooldownError.ts
Normal file
38
fluxer_api/src/errors/HarvestOnCooldownError.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/constants/API';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class HarvestOnCooldownError extends FluxerAPIError {
|
||||
constructor({retryAfter}: {retryAfter: Date}) {
|
||||
const retryAfterSeconds = Math.ceil((retryAfter.getTime() - Date.now()) / 1000);
|
||||
super({
|
||||
code: APIErrorCodes.HARVEST_ON_COOLDOWN,
|
||||
message: 'You can only request a data package once every 7 days.',
|
||||
status: 429,
|
||||
data: {
|
||||
retry_after: retryAfterSeconds,
|
||||
},
|
||||
headers: {
|
||||
'Retry-After': retryAfterSeconds.toString(),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/InputValidationError.ts
Normal file
36
fluxer_api/src/errors/InputValidationError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
import type {ValidationError} from './ValidationError';
|
||||
|
||||
export class InputValidationError extends BadRequestError {
|
||||
constructor(errors: Array<ValidationError>) {
|
||||
super({code: APIErrorCodes.INVALID_FORM_BODY, message: 'Input Validation Error', data: {errors}});
|
||||
}
|
||||
|
||||
static create(path: string, message: string): InputValidationError {
|
||||
return new InputValidationError([{path, message}]);
|
||||
}
|
||||
|
||||
static createMultiple(errors: Array<{field: string; message: string}>): InputValidationError {
|
||||
return new InputValidationError(errors.map((e) => ({path: e.field, message: e.message})));
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/InternalServerError.ts
Normal file
36
fluxer_api/src/errors/InternalServerError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {FluxerAPIError, type FluxerErrorData} from './FluxerAPIError';
|
||||
|
||||
export class InternalServerError extends FluxerAPIError {
|
||||
constructor({
|
||||
code,
|
||||
message = 'Internal Server Error',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
code: string;
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
}) {
|
||||
super({code, message, status: 500, data, headers});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidAclsFormatError.ts
Normal file
27
fluxer_api/src/errors/InvalidAclsFormatError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidAclsFormatError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.INVALID_ACLS_FORMAT, message: 'ACLs must be null or an array of strings'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidApiOriginError.ts
Normal file
30
fluxer_api/src/errors/InvalidApiOriginError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class InvalidApiOriginError extends FluxerAPIError {
|
||||
constructor() {
|
||||
super({
|
||||
code: 'INVALID_API_ORIGIN',
|
||||
message: 'This endpoint cannot be accessed from this origin. Please use api.fluxer.app for all API requests.',
|
||||
status: 403,
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidBotFlagError.ts
Normal file
27
fluxer_api/src/errors/InvalidBotFlagError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidBotFlagError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.INVALID_BOT_FLAG, message: 'is_bot must be a boolean'});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidCaptchaError.ts
Normal file
30
fluxer_api/src/errors/InvalidCaptchaError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidCaptchaError extends BadRequestError {
|
||||
constructor(message: string = 'Invalid captcha verification') {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_CAPTCHA,
|
||||
message,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidChannelTypeError.ts
Normal file
30
fluxer_api/src/errors/InvalidChannelTypeError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidChannelTypeError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_CHANNEL_TYPE,
|
||||
message: 'Invalid channel type for this operation',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidChannelTypeForCallError.ts
Normal file
30
fluxer_api/src/errors/InvalidChannelTypeForCallError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidChannelTypeForCallError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_CHANNEL_TYPE_FOR_CALL,
|
||||
message: 'Calls can only be created in DM or Group DM channels',
|
||||
});
|
||||
}
|
||||
}
|
||||
26
fluxer_api/src/errors/InvalidClientError.ts
Normal file
26
fluxer_api/src/errors/InvalidClientError.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {OAuth2Error} from './OAuth2Error';
|
||||
|
||||
export class InvalidClientError extends OAuth2Error {
|
||||
constructor(message = 'Invalid client credentials') {
|
||||
super({error: 'invalid_client', errorDescription: message, status: 401});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidDiscriminatorError.ts
Normal file
30
fluxer_api/src/errors/InvalidDiscriminatorError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidDiscriminatorError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.DISCRIMINATOR_REQUIRED,
|
||||
message: 'Invalid discriminator',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidDsaReportTargetError.ts
Normal file
30
fluxer_api/src/errors/InvalidDsaReportTargetError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidDsaReportTargetError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_DSA_REPORT_TARGET,
|
||||
message: 'The report target provided for this DSA report is invalid.',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidDsaTicketError.ts
Normal file
30
fluxer_api/src/errors/InvalidDsaTicketError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidDsaTicketError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_DSA_TICKET,
|
||||
message: 'Invalid or expired ticket. Please verify your email again before submitting the report.',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidDsaVerificationCodeError.ts
Normal file
30
fluxer_api/src/errors/InvalidDsaVerificationCodeError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidDsaVerificationCodeError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_DSA_VERIFICATION_CODE,
|
||||
message: 'Invalid or expired verification code. Please request a new email.',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidFlagsFormatError.ts
Normal file
27
fluxer_api/src/errors/InvalidFlagsFormatError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidFlagsFormatError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.INVALID_FLAGS_FORMAT, message: 'Flags must be a string or number'});
|
||||
}
|
||||
}
|
||||
26
fluxer_api/src/errors/InvalidGrantError.ts
Normal file
26
fluxer_api/src/errors/InvalidGrantError.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {OAuth2Error} from './OAuth2Error';
|
||||
|
||||
export class InvalidGrantError extends OAuth2Error {
|
||||
constructor(message = 'The provided authorization grant is invalid, expired, or revoked') {
|
||||
super({error: 'invalid_grant', errorDescription: message, status: 400});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidPackTypeError.ts
Normal file
30
fluxer_api/src/errors/InvalidPackTypeError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidPackTypeError extends BadRequestError {
|
||||
constructor(expectedType: 'emoji' | 'sticker') {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_PACK_TYPE,
|
||||
message: `Pack is not ${expectedType === 'emoji' ? 'an emoji' : 'a sticker'} pack`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidPhoneNumberError.ts
Normal file
30
fluxer_api/src/errors/InvalidPhoneNumberError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidPhoneNumberError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_PHONE_NUMBER,
|
||||
message: 'Phone number must be in E.164 format (e.g., +1234567890)',
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidPhoneVerificationCodeError.ts
Normal file
30
fluxer_api/src/errors/InvalidPhoneVerificationCodeError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidPhoneVerificationCodeError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_PHONE_VERIFICATION_CODE,
|
||||
message: 'Invalid verification code',
|
||||
});
|
||||
}
|
||||
}
|
||||
26
fluxer_api/src/errors/InvalidRequestError.ts
Normal file
26
fluxer_api/src/errors/InvalidRequestError.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {OAuth2Error} from './OAuth2Error';
|
||||
|
||||
export class InvalidRequestError extends OAuth2Error {
|
||||
constructor(message = 'The request is missing a required parameter or is otherwise malformed') {
|
||||
super({error: 'invalid_request', errorDescription: message, status: 400});
|
||||
}
|
||||
}
|
||||
26
fluxer_api/src/errors/InvalidScopeError.ts
Normal file
26
fluxer_api/src/errors/InvalidScopeError.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {OAuth2Error} from './OAuth2Error';
|
||||
|
||||
export class InvalidScopeError extends OAuth2Error {
|
||||
constructor(message = 'The requested scope is invalid or unsupported') {
|
||||
super({error: 'invalid_scope', errorDescription: message, status: 400});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/InvalidSuspiciousFlagsFormatError.ts
Normal file
30
fluxer_api/src/errors/InvalidSuspiciousFlagsFormatError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidSuspiciousFlagsFormatError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.INVALID_SUSPICIOUS_FLAGS_FORMAT,
|
||||
message: 'Suspicious activity flags must be a number or null',
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidSystemFlagError.ts
Normal file
27
fluxer_api/src/errors/InvalidSystemFlagError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidSystemFlagError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.INVALID_SYSTEM_FLAG, message: 'is_system must be a boolean'});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidTimestampError.ts
Normal file
27
fluxer_api/src/errors/InvalidTimestampError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class InvalidTimestampError extends BadRequestError {
|
||||
constructor(message: string = 'Invalid timestamp format') {
|
||||
super({code: APIErrorCodes.INVALID_TIMESTAMP, message});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvalidTokenError.ts
Normal file
27
fluxer_api/src/errors/InvalidTokenError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {FluxerAPIError} from './FluxerAPIError';
|
||||
|
||||
export class InvalidTokenError extends FluxerAPIError {
|
||||
constructor(message = 'Invalid token') {
|
||||
super({code: APIErrorCodes.INVALID_TOKEN, message, status: 401});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/InvitesDisabledError.ts
Normal file
27
fluxer_api/src/errors/InvitesDisabledError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class InvitesDisabledError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.INVITES_DISABLED, message: 'Invites are disabled for this community'});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/IpBannedError.ts
Normal file
27
fluxer_api/src/errors/IpBannedError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class IpBannedError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.IP_BANNED, message: 'Your IP address has been banned'});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/IpBannedFromGuildError.ts
Normal file
27
fluxer_api/src/errors/IpBannedFromGuildError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {ForbiddenError} from './ForbiddenError';
|
||||
|
||||
export class IpBannedFromGuildError extends ForbiddenError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.USER_IP_BANNED_FROM_GUILD, message: 'Your IP address is banned from this guild.'});
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/LockedError.ts
Normal file
36
fluxer_api/src/errors/LockedError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {FluxerAPIError, type FluxerErrorData} from './FluxerAPIError';
|
||||
|
||||
export class LockedError extends FluxerAPIError {
|
||||
constructor({
|
||||
code,
|
||||
message = 'Resource Locked',
|
||||
headers,
|
||||
data,
|
||||
}: {
|
||||
code: string;
|
||||
message?: string;
|
||||
data?: FluxerErrorData;
|
||||
headers?: Record<string, string>;
|
||||
}) {
|
||||
super({code, message, status: 423, data, headers});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/MaxBookmarksError.ts
Normal file
35
fluxer_api/src/errors/MaxBookmarksError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_BOOKMARKS_NON_PREMIUM, MAX_BOOKMARKS_PREMIUM} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxBookmarksError extends BadRequestError {
|
||||
constructor(isPremium: boolean) {
|
||||
const limit = isPremium ? MAX_BOOKMARKS_PREMIUM : MAX_BOOKMARKS_NON_PREMIUM;
|
||||
super({
|
||||
code: APIErrorCodes.MAX_BOOKMARKS,
|
||||
message: `Maximum number of bookmarks reached (${limit}).`,
|
||||
data: {
|
||||
max_bookmarks: limit,
|
||||
is_premium: isPremium,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxCategoryChannelsError.ts
Normal file
30
fluxer_api/src/errors/MaxCategoryChannelsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_CHANNELS_PER_CATEGORY} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxCategoryChannelsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_CATEGORY_CHANNELS,
|
||||
message: `Maximum number of channels in this category reached (${MAX_CHANNELS_PER_CATEGORY}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
35
fluxer_api/src/errors/MaxFavoriteMemesError.ts
Normal file
35
fluxer_api/src/errors/MaxFavoriteMemesError.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_FAVORITE_MEMES_NON_PREMIUM, MAX_FAVORITE_MEMES_PREMIUM} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxFavoriteMemesError extends BadRequestError {
|
||||
constructor(isPremium: boolean) {
|
||||
const limit = isPremium ? MAX_FAVORITE_MEMES_PREMIUM : MAX_FAVORITE_MEMES_NON_PREMIUM;
|
||||
super({
|
||||
code: APIErrorCodes.MAX_FAVORITE_MEMES,
|
||||
message: `Maximum number of favorite memes reached (${limit}).`,
|
||||
data: {
|
||||
max_favorite_memes: limit,
|
||||
is_premium: isPremium,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
33
fluxer_api/src/errors/MaxGroupDmRecipientsError.ts
Normal file
33
fluxer_api/src/errors/MaxGroupDmRecipientsError.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GROUP_DM_RECIPIENTS} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGroupDmRecipientsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GROUP_DM_RECIPIENTS,
|
||||
message: `Group DMs can have a maximum of ${MAX_GROUP_DM_RECIPIENTS} recipients.`,
|
||||
data: {
|
||||
max_recipients: MAX_GROUP_DM_RECIPIENTS,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
33
fluxer_api/src/errors/MaxGroupDmsError.ts
Normal file
33
fluxer_api/src/errors/MaxGroupDmsError.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GROUP_DMS_PER_USER} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGroupDmsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GROUP_DMS,
|
||||
message: `You can be a member of at most ${MAX_GROUP_DMS_PER_USER} group DMs.`,
|
||||
data: {
|
||||
max_group_dms: MAX_GROUP_DMS_PER_USER,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildChannelsError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildChannelsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GUILD_CHANNELS} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildChannelsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GUILD_CHANNELS,
|
||||
message: `Maximum number of guild channels reached (${MAX_GUILD_CHANNELS}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildEmojisAnimatedError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildEmojisAnimatedError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GUILD_EMOJIS_ANIMATED} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildEmojisAnimatedError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_ANIMATED_EMOJIS,
|
||||
message: `Maximum number of animated guild emojis reached (${MAX_GUILD_EMOJIS_ANIMATED}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildEmojisStaticError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildEmojisStaticError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GUILD_EMOJIS_STATIC} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildEmojisStaticError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_EMOJIS,
|
||||
message: `Maximum number of static guild emojis reached (${MAX_GUILD_EMOJIS_STATIC}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildInvitesError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildInvitesError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GUILD_INVITES} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildInvitesError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_INVITES,
|
||||
message: `Maximum number of guild invites reached (${MAX_GUILD_INVITES}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildMembersError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildMembersError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildMembersError extends BadRequestError {
|
||||
constructor(maxMembers: number) {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GUILD_MEMBERS,
|
||||
message: `Maximum number of guild members reached (${maxMembers}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildRolesError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildRolesError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_GUILD_ROLES} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildRolesError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GUILD_ROLES,
|
||||
message: `Maximum number of guild roles reached (${MAX_GUILD_ROLES}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildStickersStaticError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildStickersStaticError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildStickersStaticError extends BadRequestError {
|
||||
constructor(maxStickers: number) {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_STICKERS,
|
||||
message: `Maximum number of guild stickers reached (${maxStickers}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxGuildsError.ts
Normal file
30
fluxer_api/src/errors/MaxGuildsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxGuildsError extends BadRequestError {
|
||||
constructor(limit: number) {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_GUILDS,
|
||||
message: `Maximum number of guilds reached (${limit}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
33
fluxer_api/src/errors/MaxPackExpressionsError.ts
Normal file
33
fluxer_api/src/errors/MaxPackExpressionsError.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxPackExpressionsError extends BadRequestError {
|
||||
constructor(maxExpressions: number) {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_PACK_EXPRESSIONS,
|
||||
message: `Pack may contain at most ${maxExpressions} expressions`,
|
||||
data: {
|
||||
max_expressions: maxExpressions,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
36
fluxer_api/src/errors/MaxPackLimitError.ts
Normal file
36
fluxer_api/src/errors/MaxPackLimitError.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxPackLimitError extends BadRequestError {
|
||||
constructor(packType: 'emoji' | 'sticker', limit: number, action: 'create' | 'install') {
|
||||
const actionLabel = action === 'create' ? 'create' : 'install';
|
||||
super({
|
||||
code: APIErrorCodes.MAX_PACKS,
|
||||
message: `You can only ${actionLabel} up to ${limit} ${packType} packs`,
|
||||
data: {
|
||||
pack_type: packType,
|
||||
limit,
|
||||
action,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxReactionsPerMessageError.ts
Normal file
30
fluxer_api/src/errors/MaxReactionsPerMessageError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_REACTIONS_PER_MESSAGE} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxReactionsPerMessageError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_REACTIONS,
|
||||
message: `Maximum number of reactions per message reached (${MAX_REACTIONS_PER_MESSAGE}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxRelationshipsError.ts
Normal file
30
fluxer_api/src/errors/MaxRelationshipsError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_RELATIONSHIPS} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxRelationshipsError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_FRIENDS,
|
||||
message: `Maximum number of relationships reached (${MAX_RELATIONSHIPS}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxUsersPerMessageReactionError.ts
Normal file
30
fluxer_api/src/errors/MaxUsersPerMessageReactionError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_USERS_PER_MESSAGE_REACTION} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxUsersPerMessageReactionError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_REACTIONS,
|
||||
message: `Maximum number of users per message reaction reached (${MAX_USERS_PER_MESSAGE_REACTION}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxWebhooksPerChannelError.ts
Normal file
30
fluxer_api/src/errors/MaxWebhooksPerChannelError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_WEBHOOKS_PER_CHANNEL} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxWebhooksPerChannelError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_WEBHOOKS,
|
||||
message: `Maximum number of webhooks per channel reached (${MAX_WEBHOOKS_PER_CHANNEL}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MaxWebhooksPerGuildError.ts
Normal file
30
fluxer_api/src/errors/MaxWebhooksPerGuildError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes, MAX_WEBHOOKS_PER_GUILD} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MaxWebhooksPerGuildError extends BadRequestError {
|
||||
constructor() {
|
||||
super({
|
||||
code: APIErrorCodes.MAX_WEBHOOKS_PER_GUILD,
|
||||
message: `Maximum number of webhooks per guild reached (${MAX_WEBHOOKS_PER_GUILD}).`,
|
||||
});
|
||||
}
|
||||
}
|
||||
30
fluxer_api/src/errors/MediaMetadataError.ts
Normal file
30
fluxer_api/src/errors/MediaMetadataError.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MediaMetadataError extends BadRequestError {
|
||||
constructor(source: string) {
|
||||
super({
|
||||
code: APIErrorCodes.MEDIA_METADATA_ERROR,
|
||||
message: `Failed to get media metadata from ${source}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
27
fluxer_api/src/errors/MfaNotDisabledError.ts
Normal file
27
fluxer_api/src/errors/MfaNotDisabledError.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Fluxer Contributors
|
||||
*
|
||||
* This file is part of Fluxer.
|
||||
*
|
||||
* Fluxer is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Fluxer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {APIErrorCodes} from '~/Constants';
|
||||
import {BadRequestError} from './BadRequestError';
|
||||
|
||||
export class MfaNotDisabledError extends BadRequestError {
|
||||
constructor() {
|
||||
super({code: APIErrorCodes.TWO_FA_NOT_ENABLED, message: 'You must disable MFA to perform this action.'});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user