Re: [Vala] GLib.assert_no_error not working?



On Thu, Mar 8, 2018 at 9:26 PM, Al Thomas <astavale yahoo co uk> wrote:
The assertion is in a catch block so err will be set. Whereas assert_no_error is used to check err is unset (i.e. null). The line about 'produce a message that includes the error message and code' seems like a copy/paste error in the documentation.

That doesn't seem right at all. What's the point of the argument then?

What you might want is assert_error, but the C docs for that advise 'If you want to test that err is set, but don't care what it's set to, just use g_assert (err != NULL)'

I'd like to stop the test if an exception has been thrown, i.e. it's abnormal that an error has been thrown. So assert_error is not the right check since it's the opposite of what I am looking for. "assert(err == NULL)" would be correct, but that it wouldn't tell me what the unexpected error was.

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]