Skip to main content

LanguageDataNotExist

The LanguageDataNotExist exception is thrown when attempting to add a language from predefined data that doesn't exist.

Namespace

JobMetric\Language\Exceptions\LanguageDataNotExist

When It's Thrown

Thrown when calling Language::addLanguageData($locale) and the locale doesn't exist in the predefined data file.

When to Use LanguageDataNotExist

This exception is thrown automatically when:

  • Calling Language::addLanguageData($locale) with a locale that doesn't exist in the predefined data file
  • The data file is missing or corrupted

Handling the Exception

use JobMetric\Language\Exceptions\LanguageDataNotExist;

try {
Language::addLanguageData('xx');
} catch (LanguageDataNotExist $e) {
return response()->json([
'error' => $e->getMessage(),
], 400);
}