Skip to main content

Function: errorMessageCaseNormalization()

Gala Launchpad SDK 9.0.0-rc.5


Gala Launchpad SDK 9.0.0-rc.5 / index / errorMessageCaseNormalization

Function: errorMessageCaseNormalization()

errorMessageCaseNormalization(message): string

Defined in: packages/launchpad-sdk/dist/utils/string-patterns.d.ts:179

Normalize error message to lowercase for consistent error pattern matching.

Converts error messages to lowercase for case-insensitive substring searching. Useful for matching specific error conditions regardless of message casing.

Consolidated from 8 duplicated patterns in error type matching:

  • error.message.toLowerCase().includes('pattern')
  • message.toLowerCase().includes('insufficient')

Parameters​

message​

string

The error message to normalize

Returns​

string

Lowercase version of the message

Examples​

Error pattern matching

import { errorMessageCaseNormalization } from '@gala-chain/launchpad-sdk';

try {
// ... operation
} catch (error: unknown) {
const normalized = errorMessageCaseNormalization(error.message);
if (normalized.includes('insufficient balance')) {
// Handle insufficient balance
}
}

Transaction error categorization

import { errorMessageCaseNormalization } from '@gala-chain/launchpad-sdk';

const errorMsg = 'TRANSACTION FAILED: Insufficient Balance';
const normalized = errorMessageCaseNormalization(errorMsg);

if (normalized.includes('insufficient')) {
console.log('Balance error');
}
if (normalized.includes('transaction')) {
console.log('Tx error');
}

Since​

6.14.0