-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
144 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,3 @@ | ||
package constants | ||
|
||
var ERROR_MESSAGES = map[string]string{ | ||
"NotFound": "The {fileName} file wasn't found in the current directory.", | ||
|
||
"Default": "Something went wrong, please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"Dependencies": "An error occurred while installing dependencies, please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"Husky": "An error has occurred during the Husky configuration process, please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"CommitLintConfig": "An error has occurred during the commitlint configuration process, please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"AddCommitLint": "An error occurred while asking if you wanna add commitlint, please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"PackageManagerSelection": "An error occurred while selecting the package manager, please try again later, if the error persists, please report it on " + ISSUES + ".", | ||
|
||
"CreateEmptyFile": "An error occurred while creating the empty file. Please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"CreateFolder": "An error occurred while creating the folder: {folderName}, please try again later, if the error persists, please report it on " + ISSUES + ".", | ||
|
||
"ReadFile": "An error has occurred while reading the {fileName} file, please try again later, if the error persists, please report it on " + ISSUES + ".", | ||
|
||
"WriteFile": "An error has occurred while writing to the {fileName} file, please try again later, if the error persists, please report it on " + ISSUES + ".", | ||
|
||
"ConfigFilesCreate": "An error occurred while creating configuration files. Please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"ShouldPublishToNpm": "An error occurred while confirming npm publication. Please try again later, if the error persists, please report it on" + ISSUES + ".", | ||
|
||
"NpmIgnoreWrite": "An error occurred while writing to the '.npmignore' file. Please try again later, if the error persists please report it on " + ISSUES + ".", | ||
|
||
"GitHubRepoOpen": "An error occurred while opening the GitHub repository in a new browser tab. Please try again later, if the error persists please report it on" + ISSUES + ".", | ||
|
||
"JsonUnmarshal": "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
"JsonMarshal": "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
"GetWorkingDirectory": "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
"InvalidTypeForFilesToAdd": "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
"CheckingFolderOrFile": "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
} | ||
const BASE_ERROR_MESSAGE = "Please try again later, if the error persists please report it on " + ISSUES + "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package enums | ||
|
||
type FileError string | ||
type ConfigError string | ||
type ProcessError string | ||
type UserInputError string | ||
|
||
const ( | ||
NotFoundError FileError = "NotFound" | ||
ReadFileError FileError = "ReadFile" | ||
WriteFileError FileError = "WriteFile" | ||
CreateEmptyFileError FileError = "CreateEmptyFile" | ||
CreateFolderError FileError = "CreateFolder" | ||
NpmIgnoreWriteError FileError = "NpmIgnoreWrite" | ||
AddScriptError FileError = "AddScript" | ||
) | ||
|
||
const ( | ||
HuskyError ConfigError = "Husky" | ||
CommitLintConfigError ConfigError = "CommitLintConfig" | ||
ConfigFilesCreateError ConfigError = "ConfigFilesCreate" | ||
) | ||
|
||
const ( | ||
JsonUnmarshalError ProcessError = "JsonUnmarshal" | ||
JsonMarshalError ProcessError = "JsonMarshal" | ||
GetWorkingDirectoryError ProcessError = "GetWorkingDirectory" | ||
InvalidTypeForFilesToAddError ProcessError = "InvalidTypeForFilesToAdd" | ||
CheckingFolderOrFileError ProcessError = "CheckingFolderOrFile" | ||
DependenciesError ProcessError = "Dependencies" | ||
GitHubRepoOpenError ProcessError = "GitHubRepoOpen" | ||
) | ||
|
||
const ( | ||
AddCommitLintError UserInputError = "AddCommitLint" | ||
PackageManagerSelectionError UserInputError = "PackageManagerSelection" | ||
ShouldPublishToNpmError UserInputError = "ShouldPublishToNpm" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package error_messages | ||
|
||
import "github.com/RaulCatalinas/HuskyBC/internal/enums" | ||
|
||
var CONFIG_ERROR_MESSAGES = map[enums.ConfigError]string{ | ||
enums.HuskyError: generateErrorMessage("configuring Husky"), | ||
enums.CommitLintConfigError: generateErrorMessage("configuring commitlint"), | ||
enums.ConfigFilesCreateError: generateErrorMessage("creating configuration files"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package error_messages | ||
|
||
import "github.com/RaulCatalinas/HuskyBC/internal/enums" | ||
|
||
var FILE_ERROR_MESSAGES = map[enums.FileError]string{ | ||
enums.NotFoundError: "The {fileName} file wasn't found in the current directory.", | ||
enums.ReadFileError: generateErrorMessage("reading the {fileName} file"), | ||
enums.WriteFileError: generateErrorMessage("writing to the {fileName} file"), | ||
enums.CreateEmptyFileError: generateErrorMessage("creating the empty file"), | ||
enums.CreateFolderError: generateErrorMessage("creating the folder"), | ||
enums.NpmIgnoreWriteError: generateErrorMessage("writing to the '.npmignore' file"), | ||
enums.AddScriptError: generateErrorMessage("trying to add a script to the package.json file."), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package error_messages | ||
|
||
import ( | ||
"github.com/RaulCatalinas/HuskyBC/internal/constants" | ||
) | ||
|
||
const DEFAULT_ERROR_MESSAGE = "Something went wrong. " + constants.BASE_ERROR_MESSAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package error_messages | ||
|
||
import "github.com/RaulCatalinas/HuskyBC/internal/enums" | ||
|
||
var PROCESS_ERROR_MESSAGES = map[enums.ProcessError]string{ | ||
enums.JsonUnmarshalError: "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
enums.JsonMarshalError: "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
enums.GetWorkingDirectoryError: "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
enums.InvalidTypeForFilesToAddError: "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
enums.CheckingFolderOrFileError: "Replace this with an error message that's descriptive and easily understandable by any developer.", | ||
|
||
enums.DependenciesError: generateErrorMessage("installing dependencies"), | ||
|
||
enums.GitHubRepoOpenError: generateErrorMessage("opening the GitHub repository in a new browser tab"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package error_messages | ||
|
||
import "github.com/RaulCatalinas/HuskyBC/internal/enums" | ||
|
||
var USER_INPUT_ERROR_MESSAGES = map[enums.UserInputError]string{ | ||
enums.AddCommitLintError: generateErrorMessage("asking if you want to add commitlint"), | ||
|
||
enums.PackageManagerSelectionError: generateErrorMessage("selecting the package manager"), | ||
|
||
enums.ShouldPublishToNpmError: generateErrorMessage("confirming npm publication"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package error_messages | ||
|
||
import "github.com/RaulCatalinas/HuskyBC/internal/constants" | ||
|
||
func generateErrorMessage(action string) string { | ||
return "An error occurred while " + action + ". " + constants.BASE_ERROR_MESSAGE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.