/* * © 2024 Snyk Limited * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SizeLimitExceededError = exports.FilesLimitExceededError = exports.IntegrationAuthorizationFailedError = exports.IntegrationAuthenticationFailedError = exports.RevisionNotResolvedError = exports.UnsupportedIntegrationTypeError = void 0; const types_1 = require("../types"); const problem_error_1 = require("../problem-error"); /** * @class * @name UnsupportedIntegrationTypeError * @description The integration you provided does not support SCM repository access. * * See more: * - [https://docs.snyk.io/scm-ide-and-ci-cd-workflow-and-integrations/snyk-scm-integrations](https://docs.snyk.io/scm-ide-and-ci-cd-workflow-and-integrations/snyk-scm-integrations) * @summary Integration type not supported * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class UnsupportedIntegrationTypeError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Integration type not supported', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0001', status: 500, description: `The integration you provided does not support SCM repository access.`, errorCode: 'SNYK-SCM-0001', level: 'error', classification: types_1.Classification.UNSUPPORTED, instance, }, details, Object.assign({ links: [ 'https://docs.snyk.io/scm-ide-and-ci-cd-workflow-and-integrations/snyk-scm-integrations', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.UnsupportedIntegrationTypeError = UnsupportedIntegrationTypeError; /** * @class * @name RevisionNotResolvedError * @description Snyk was unable to resolve the SCM revision you provided. Provide a valid revision, either a full commit ID or an existing commit reference. * @summary Revision cannot be resolved * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class RevisionNotResolvedError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Revision cannot be resolved', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0002', status: 422, description: `Snyk was unable to resolve the SCM revision you provided. Provide a valid revision, either a full commit ID or an existing commit reference.`, errorCode: 'SNYK-SCM-0002', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.RevisionNotResolvedError = RevisionNotResolvedError; /** * @class * @name IntegrationAuthenticationFailedError * @description Snyk was unable to authenticate with your SCM provider. Ensure you are using valid credentials for the Snyk integration. * @summary Integration authentication failed * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class IntegrationAuthenticationFailedError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Integration authentication failed', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0003', status: 401, description: `Snyk was unable to authenticate with your SCM provider. Ensure you are using valid credentials for the Snyk integration.`, errorCode: 'SNYK-SCM-0003', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.IntegrationAuthenticationFailedError = IntegrationAuthenticationFailedError; /** * @class * @name IntegrationAuthorizationFailedError * @description Snyk was unable to authorize with your SCM provider. If your Organization has SAML SSO enabled or enforced, re-authorize the OAuth Application `Snyk`. * @summary Integration authorization failed * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class IntegrationAuthorizationFailedError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Integration authorization failed', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0004', status: 401, description: `Snyk was unable to authorize with your SCM provider. If your Organization has SAML SSO enabled or enforced, re-authorize the OAuth Application \`Snyk\`.`, errorCode: 'SNYK-SCM-0004', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.IntegrationAuthorizationFailedError = IntegrationAuthorizationFailedError; /** * @class * @name FilesLimitExceededError * @description Snyk was unable to retrieve the repository because the overall file count exceeds the limit of 40000. * * To reduce the file count, use a `.snyk` file to ignore certain directories or files. Alternatively, analyze individual work subdirectories separately. * @summary Too many files * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FilesLimitExceededError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Too many files', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0005', status: 500, description: `Snyk was unable to retrieve the repository because the overall file count exceeds the limit of 40000. To reduce the file count, use a \`.snyk\` file to ignore certain directories or files. Alternatively, analyze individual work subdirectories separately.`, errorCode: 'SNYK-SCM-0005', level: 'error', classification: types_1.Classification.UNSUPPORTED, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FilesLimitExceededError = FilesLimitExceededError; /** * @class * @name SizeLimitExceededError * @description Snyk was unable to retrieve the repository because the size of the repository exceeds 15 GB. * * To reduce the overall size of the repository, use a a `.snyk` file to ignore certain directories or files. Alternatively, analyze individual work subdirectories separately. * @summary Repository size too large * @category SCM * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class SizeLimitExceededError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Repository size too large', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-scm-0006', status: 500, description: `Snyk was unable to retrieve the repository because the size of the repository exceeds 15 GB. To reduce the overall size of the repository, use a a \`.snyk\` file to ignore certain directories or files. Alternatively, analyze individual work subdirectories separately.`, errorCode: 'SNYK-SCM-0006', level: 'error', classification: types_1.Classification.UNSUPPORTED, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.SizeLimitExceededError = SizeLimitExceededError; //# sourceMappingURL=SCM-error-catalog.js.map