Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added API_NOT_ENABLED (Google project not found). #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ErrorHandler.gs.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ NORMALIZED_ERRORS = {
SERVICE_ERROR: "Service error",
INVALID_ARGUMENT: 'Invalid argument',
SHEET_ALREADY_EXISTS_PLEASE_ENTER_ANOTHER_NAME: 'A sheet with this name already exists. Please enter another name.',
API_NOT_ENABLED: 'Project is not found and cannot be used for API calls',
};

/**
Expand Down Expand Up @@ -523,6 +524,7 @@ NORETRY_ERRORS[NORMALIZED_ERRORS.AUTHORIZATION_REQUIRED] = true;
NORETRY_ERRORS[NORMALIZED_ERRORS.INVALID_ARGUMENT] = true;
NORETRY_ERRORS[NORMALIZED_ERRORS.ACTION_NOT_ALLOWED_THROUGH_EXEC_API] = true;
NORETRY_ERRORS[NORMALIZED_ERRORS.DAILY_LIMIT_EXCEEDED] = true;
NORETRY_ERRORS[NORMALIZED_ERRORS.API_NOT_ENABLED] = true;

// noinspection JSUnusedGlobalSymbols, ThisExpressionReferencesGlobalObjectJS
this['ErrorHandler'] = {
Expand Down Expand Up @@ -823,6 +825,9 @@ ErrorHandler_._ERROR_MESSAGE_TRANSLATIONS = {

// "The Google Calendar is not enabled for the user." - eg: CalendarApp.getDefaultCalendar()
"The Google Calendar is not enabled for the user.": { ref: NORMALIZED_ERRORS.CALENDAR_SERVICE_NOT_ENABLED, locale: 'en'},

// Google Project not found. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
"Google Project not found. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.": { ref: NORMALIZED_ERRORS.API_NOT_ENABLED, locale: 'en'}
};

/**
Expand Down Expand Up @@ -1037,6 +1042,10 @@ ErrorHandler_._ERROR_PARTIAL_MATCH = [
variables: ['sheetName'],
ref: NORMALIZED_ERRORS.SHEET_ALREADY_EXISTS_PLEASE_ENTER_ANOTHER_NAME,
locale: 'sk'},
{regex: /^Project ([0-9]+) is not found and cannot be used for API calls\. If it is recently created, enable (.*) by visiting (.*) then retry\. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry\.$/,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change your RegExp to:

/^Project (\S+) is not found and cannot be used for API calls\. If it is recently created, enable (.*?) by visiting (.*?) then retry\. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry\.$/

variables: ['projectId', 'apiName', 'consoleUrl'],
ref: NORMALIZED_ERRORS.API_NOT_ENABLED,
locale: 'en'},
];

/**
Expand Down