Skip to content

API: Expose Access to Compiler Warnings #3079

@bdkjones

Description

@bdkjones

Issue:

Looking at error_handling.cpp, all deprecation warnings are currently hard-coded to print to STDERR.

Could this be changed so that implementors have access to these warnings, like we do for actual errors? STDERR is only useful if libsass is running in a Terminal environment, which it isn't in my case.

Proposal:

If a custom function to handle @warn statements is registered with Libsass, call that function and pass the deprecation warning just as you would for a normal @warn statement. If there is no custom handler for @warn registered, then fallback to printing the warnings to STDERR.

To allow implementors to differentiate between user warnings and compiler warnings, we could add one more property-getter such as sass_warning_get_origin(). Or an alternate name like sass_warning_is_user_generated(), etc.

Complexity

I do see a few variants of the deprecation handlers in error_handling.cpp, but it looks like all of them have the same information as a normal @warn: filename, line, column, message.

Version:

Libsass 3.6.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions