The library throws exceptions from the namespace axy\sourcemap\error.
The basic exception for the format errors. These errors occur when you create a SourceMap object or when load from file.
$data = [
'version' => 3,
'file' => 'out.js',
'sources' => 'sources',
'mappings' => 'A',
];
$map = new SourceMap($data); // Source map section "sources" is invalid: "must be an array"The section mappings has an invalid format.
Occurs when calling loadFromFile(): file is not JSON.
Version 3 is supported only.
Error when work with the indexed fields sources and names.
$pos = [
'generated' => ['line' => 5, 'column' => 10],
'source' => ['fileIndex' => 5, 'line' => 3, 'column' => 0],
];If a file with index #5 is not exists in "sources" it is error.
Error when working with files (loadFromFile() and save()).
File not found or permission denied.
Call save() without $filename argument when the default file is not defined.
$pos = [
'generated' => ['line' => 5],
'source' => ['fileIndex' => 5],
];
$map->addPosition($pos);Required generated.column.