How to pass non-fatal warnings from a library
Posted
by wRAR
on Stack Overflow
See other posts from Stack Overflow
or by wRAR
Published on 2010-03-19T14:33:05Z
Indexed on
2010/03/19
14:41 UTC
Read the original article
Hit count: 189
A library function parses a file and returns an object. If a parser encounters unknown data, missing values etc., it shouldn't throw an exception and stop parsing (because this is not fatal), but there should be a way to pass information about these things to a caller (so that warnings can be displayed in the UI, for example). How can these warning be returned? I'm thinking of passing a callback function/object into the library, are there any other possible solutions?
© Stack Overflow or respective owner