Releases: ncoden/sass-errors
Releases · ncoden/sass-errors
v0.4.1
v0.4.0
Major changes:
- Add unit tests. (996a2fa)
- Add documentation. (85e69ad)
- Change
se-try
andse-try-catch
behavior (see below).
Try/try-catch update
Fix: Make se-try
taking the value to test instead of the function to call. (9eb8eac)
- Rename the "catch function"
$catch_func_name
to "Exception Handler"$handler
. - Make
se-try-catch
taking arguments to create a custom Exception onfalse
value.
Note: The $handler
function must be defined in the same scope as sass-errors-try-catch
.
Other changes:
v0.3.0
⚠️ Breaking changes.
Move from an Error approach to an Exception approach. Throw exceptions that have to be catch, instead of displaying an error.
Changes in approach:
- A function have its normal behaviour, and throw an exception if something bad happen.
- Only provide exceptions to create and throw
- "False" is the only semantical value to return errors.
- To retrieve the error type and message, the exception must be catch.
Changes in current functions:
sass-errors-init
do not initalize errors options, but onlyprefix
an global variables.sass-errors-throw
create an exception and save it globally. The exception will be retrieved later.- Remove
sass-errors-obj
andsass-errors-obj-throw
New functions behaviors: (*: global option)
@function sass-errors-init($prefix: null)
: initialize Sass Errors@function sass-errors-new($error, $type: null, $datas: (), $prefix: *)
: create an Exception object and return it.@function sass-errors-throw($error, $type: null, $datas: (), $prefix: *)
: create an Exception object and throw it. If an Exception is passed as first parameter, throw it. Always return false: this function should be called with@return
.
New functions:
@function sass-errors-get()
: return the current non-catched Exception.@function sass-errors-is-exception()
: returntrue
if Exception has been thrown and not catched.false
otherwise.@function sass-errors-try($func_name, $func_args: ())
: Call a function with its arguments. If the function return false without throwing Exceptions, throw an Exception.@function sass-errors-catch($types...)
: If an Exception has been throw, return it. If types are given, return the Exception only if its type matches with one of the given types. Otherwise, return false.@function sass-errors-try-catch($try_func_name, $try_func_args: (),$catch_func_name: null, $catch_func_args: (), $types: ())
: Call a try function with its arguments. If the function return false or throw an Exception, catch it and pass the Exception to the given catch function with its arguments.@function sass-errors-store($obj, $error, $type: null, $datas: (), $prefix: *)
: Create an Exception and append it to the given store. The new exception is not thrown.
Other changes:
- Rename functions to use a
sass-errors
prefix instead ofserr
. - Add optional aliases for each function, with a
se-
prefix. - Add .editorconfig
📘 Documentation will be added soon.
v0.2.0
Initial Release.
Initial functions:
Add basic functions for sass-errors
:
serr-init
: initialize sass-errors with a custom configserr-message
: return a formatted message from a error message and a prefix.serr-obj
: return a new sass-error object to iterate on it.serr-throw
: throw an single error.serr-obj-throw
: throw an error and store it in a sass-error object.