Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Do not use C++ exceptions in the binding code #1133

Merged
merged 4 commits into from
Sep 10, 2015
Merged

Conversation

saper
Copy link
Member

@saper saper commented Sep 9, 2015

We are running into trouble with C++ runtime
libraries (notably by mixing libstdc++ and libc++
on MacOSX). Reduce the risk by adhering to Google
Style Guide and stop using C++ exceptions at all.

libsass should offer us a pure C interface
and promises to not throw any exceptions as well.

While here, add additional checks for list and
map values.

Fixes: #1131
Closes: #1127

This method uses Sass error value
as a vehicle to report the error message,
but returns NULL to indicate constructor
failure.

This is used to tell successful creation
of the Sass error object from the constructor
failure, where no valid Sass object can be
created.
::construct() methods may return NULL and
indicate an error in the returned error value.
In the unlikely event libsass gives us the
value we don't understand use V8 exception
to report failure and exit before calling
a user-defined custom function.

XXX We do not have currently any way
    to test this (that would require mocking
    libsass).
Fix crash in List::SetValue() etc. when trying
to add a bare JavaScript object.

Check for bare objects in lists and maps in test.

Don't use C++ exceptions in the binding code.
@saper
Copy link
Member Author

saper commented Sep 9, 2015

@mgol @xzyfer let me know how far are your Macintoshes with this patch.

@xzyfer
Copy link
Contributor

xzyfer commented Sep 9, 2015

libsass should offer us a pure C interface and promises to not throw any exceptions as well

@saper I believe we're making steps in this direction in 3.3 - sass/libsass#1544

@saper
Copy link
Member Author

saper commented Sep 9, 2015

We don't use sass_value_op in node-sass.

@xzyfer
Copy link
Contributor

xzyfer commented Sep 9, 2015

@xzyfer let me know how far are your Macintoshes with this patch.

943 passing (21s) 💯

@saper
Copy link
Member Author

saper commented Sep 9, 2015

Can you show me your full compiler flags now?

@xzyfer
Copy link
Contributor

xzyfer commented Sep 9, 2015

@xzyfer
Copy link
Contributor

xzyfer commented Sep 9, 2015

We don't use sass_value_op in node-sass.

Yep I just meant we agree with the sentiment and we're working on it. Would be worth opening a LibSass issue to track for 3.4.

@xzyfer
Copy link
Contributor

xzyfer commented Sep 10, 2015

👍 Ship it when you're comfortable @saper

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants