Predicator.Errors.LocationError (predicator v3.5.0)
View SourceError struct for location expression validation failures.
This error is raised when attempting to resolve a location path for assignment operations, but the expression does not represent a valid assignable location.
Error Types
:not_assignable
- Expression cannot be used as an assignment target:invalid_node
- Unknown or unsupported AST node type:undefined_variable
- Variable referenced in bracket key is not defined:invalid_key
- Bracket key is not a valid string or integer:computed_key
- Computed expressions cannot be used as assignment keys
Examples
# Cannot assign to literal values
%LocationError{
type: :not_assignable,
message: "Cannot assign to literal value",
details: %{expression_type: "literal value", value: 42}
}
# Cannot assign to function calls
%LocationError{
type: :not_assignable,
message: "Cannot assign to function call",
details: %{expression_type: "function call", value: "len"}
}
# Invalid bracket key type
%LocationError{
type: :invalid_key,
message: "Bracket key must be string or integer",
details: %{key_type: "boolean", key_value: true}
}
Summary
Functions
Creates a LocationError for computed expressions used as bracket keys.
Creates a LocationError for invalid bracket key types.
Creates a LocationError for invalid or unknown AST node types.
Creates a LocationError for non-assignable expressions.
Creates a LocationError for undefined variables in bracket keys.
Types
@type error_type() ::
:not_assignable
| :invalid_node
| :undefined_variable
| :invalid_key
| :computed_key
@type t() :: %Predicator.Errors.LocationError{ details: map(), message: binary(), type: error_type() }
Functions
Creates a LocationError for computed expressions used as bracket keys.
Creates a LocationError for invalid bracket key types.
Creates a LocationError for invalid or unknown AST node types.
Creates a LocationError for non-assignable expressions.
Used when an expression cannot be used as an assignment target (l-value).
Creates a LocationError for undefined variables in bracket keys.