Files
warmbly/internal/errx/common.go
Matthew Meszaros da82993846 feat: add campaign workflow backend support
Add sequence action-node storage and execution, template conditional rendering, lead progress state, profile updates, webhook fan-out throttling, and supporting repository fixes.
2026-06-06 07:49:52 +02:00

123 lines
7.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package errx
import (
"fmt"
"github.com/warmbly/warmbly/internal/config"
)
var (
ErrInvalid = New(BadRequest, "The request body contains invalid or malformed JSON.")
ErrLock = New(BadRequest, "Resource is locked. Another process is running, please wait.")
ErrColor = New(BadRequest, "Hex color must be a valid string.")
ErrUuid = New(BadRequest, "The id must be a valid uuid.")
ErrCategory = New(BadRequest, "Category doesn't exists.")
ErrTag = New(BadRequest, "Tag doesn't exists.")
ErrBitmask = New(BadRequest, "Invalid bitmask value.")
ErrRole = New(BadRequest, "Role doesn't exists.")
ErrPosition = New(BadRequest, "Invalid position.")
ErrTimezone = New(BadRequest, "Timezone doesn't exists.")
ErrTime = New(BadRequest, "Invalid time format.")
ErrNotEnough = New(BadRequest, "Not enough data to perform this action.")
ErrJSONKey = New(BadRequest, "JSON key can only contain characters and underscore.")
ErrLimit = New(BadRequest, "Limit must be between 10 and 200.")
// Authorization
ErrToken = New(Unauthorized, "Invalid or expired token.")
ErrAuth = New(Unauthorized, "Missing or invalid Authorization header.")
ErrUser = New(BadRequest, "User doesn't exists.")
ErrPassword = New(BadRequest, "Password must be at least 8 characters long.")
ErrEmail = New(BadRequest, "Invalid email address.")
ErrCredentials = New(BadRequest, "Invalid email or password.")
ErrSession = New(BadRequest, "Invalid or expired session.")
ErrCodeLimit = New(BadRequest, "Too many attempts. Start a new session and try again later.")
ErrCode = New(BadRequest, "Invalid or expired verification code.")
ErrAuthLimit = New(BadRequest, "Too many attempts, please try again later.")
ErrExternalCode = New(BadRequest, "Invalid or expired code, please try again.")
ErrExternalEmail = New(BadRequest, "Invalid or unverified email address.")
// Sessions
ErrSessionNotFound = New(NotFound, "Session not found.")
ErrSessionCurrent = New(BadRequest, "You can't revoke the session you're currently using. Use sign out instead.")
// Passkeys (WebAuthn)
ErrPasskey = New(BadRequest, "We couldnt verify that passkey. Please try again.")
ErrPasskeySession = New(BadRequest, "Your passkey request expired. Please start again.")
ErrPasskeyName = New(BadRequest, "Passkey name must be between 1 and 60 characters.")
ErrPasskeyNotFound = New(NotFound, "Passkey not found.")
ErrPasskeyExists = New(Conflict, "This passkey is already registered.")
ErrPasskeyNone = New(BadRequest, "No passkey was found for this account.")
// Roles
ErrRoleName = New(BadRequest, "Role name length must be between 3 and 100 characters.")
// Captch
ErrCaptcha = New(BadRequest, "We couldnt verify youre human. Please try the security check again or reload the page.")
// Group
ErrGroupTitle = New(BadRequest, "The title length must be between 1 and 50 characters.")
ErrGroupMax = New(BadRequest, "You reached the maximum amount.")
// Email
ErrEmailCredentials = New(BadRequest, "Invalid email credentials.")
ErrEmailValidation = New(BadRequest, "Deadline exceed, try again later.")
ErrEmailOnboardProvider = New(BadRequest, "Unsupported email provider. Use 'gmail', 'outlook', or 'smtp_imap'.")
ErrEmailOnboardState = New(BadRequest, "Invalid or expired onboarding state.")
ErrEmailOnboardCode = New(BadRequest, "Authorization code is missing or invalid.")
ErrEmailOnboardExchange = New(BadRequest, "Could not exchange the authorization code with the provider.")
ErrEmailOnboardUserInfo = New(BadRequest, "Could not read account details from the provider.")
ErrEmailOnboardAlreadyExists = New(Conflict, "This email account is already connected.")
ErrEmailOnboardNoWorker = New(ServiceUnavailable, "No mailbox workers are available right now. Please try again shortly.")
ErrEmailOnboardInboxLimit = New(Forbidden, "Your free trial includes two connected inboxes. Upgrade to add more.")
ErrEmailOnboardTrialExpired = New(Forbidden, "Your free trial has ended. Upgrade to connect inboxes.")
ErrEmailSMTPHost = New(BadRequest, "SMTP host is required.")
ErrEmailSMTPPort = New(BadRequest, "SMTP port must be 465 or 587.")
ErrEmailIMAPHost = New(BadRequest, "IMAP host is required.")
ErrEmailIMAPPort = New(BadRequest, "IMAP port must be a positive integer.")
ErrEmailCredentialsRequired = New(BadRequest, "SMTP and IMAP credentials are required.")
ErrEmailTrackingDomain = New(BadRequest, "Invalid tracking domain.")
ErrEmailTrackingDomainLength = New(BadRequest, "Tracking domain is too long (max 253 characters).")
ErrEmailName = New(BadRequest, "Invalid name. Must be 2100 characters and contain only letters, numbers, spaces, '-', '.', or ''.")
ErrEmailSignaturePlain = New(BadRequest, "Plain email signature is too long.")
ErrEmailSignatureHTML = New(BadRequest, "HTML email signature is too long.")
ErrEmailMinWaitTime = New(BadRequest, "Minimum time gap between emails must be between 0 and 86400 minutes.")
ErrEmailCampaignLimit = New(BadRequest, "Campaign limit must be between 0 and 100.")
ErrEmailWarmupBase = New(BadRequest, "Warmup base must be between 0 and 100.")
ErrEmailWarmupMax = New(BadRequest, "Warmup max amount must be between 0 and 100.")
ErrEmailWarmupIncrease = New(BadRequest, "Warmup increase amount must be between 0 and 100.")
ErrEmailReplyRate = New(BadRequest, "Warmup reply rate must be between 0 and 100.")
// Campaign
ErrCampaignName = New(BadRequest, "Campaign name length must be between 3 and 50 characters.")
ErrCampaignDescription = New(BadRequest, "Campaign description length must be below 300 characters.")
ErrCampaignDailyLimit = New(BadRequest, "Daily limit must be between 3 and 10000000.")
ErrCampaignStartDate = New(BadRequest, "Start date must be in the future, use null if you want to start now.")
ErrCampaignEndDate = New(BadRequest, "End date must be in the future.")
ErrCampaignLimit = New(BadRequest, "You reached your limit for campaigns, please try again later.")
// Sequence
ErrSequenceName = New(BadRequest, "Sequence name cannot be longer than 50 characters.")
ErrSequenceSubject = New(BadRequest, "Sequence subject cannot be longer than 100 characters.")
ErrSequenceBody = New(BadRequest, fmt.Sprintf("Sequence body cannot be longer than %d characters.", config.SequenceBodyLimit))
ErrSequenceBranch = New(BadRequest, "Invalid branching conditions.")
ErrSequenceBranchTo = New(BadRequest, "Branch target must be another step in the same campaign and cannot create a cycle.")
ErrSequenceKind = New(BadRequest, "Step kind must be email, action, or wait.")
ErrSequenceAction = New(BadRequest, "Invalid action configuration for this step.")
ErrSequenceWaitAfter = New(BadRequest, fmt.Sprintf("Step wait must be between 0 and %d days.", config.SequenceWaitAfterMax))
// Contact
ErrContactSerialize = New(BadRequest, "Failed to serialize contact.")
ErrContactSize = New(BadRequest, "Contact size cannot be bigger than 10KB.")
// Unibox
ErrUniboxLimit = New(BadRequest, fmt.Sprintf("Limit must be between %d and %d.", config.UniboxLimitMin, config.UniboxLimitMax))
ErrSeenMax = New(BadRequest, "Cannot update more than 500 messages.")
// Servers
ErrIPAddr = New(BadRequest, "Invalid IP Address.")
ErrPublicKey = New(BadRequest, "Invalid Public Key.")
)