TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

catch error messages before it reaches client

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Anthony
Date: 2017-02-09
Time: 14:17

catch error messages before it reaches client

Hey, Skrol or anyone else who might know the answer :)

I'm making a custom ErrorHandler for my server, and I would like to also have a case for TBS, but I have yet to find any way to catch any error messages from TBS.
For instance, if there is a key missing in the data that was passed, I would like to catch that error and pass it to my ErrorHandler which will then process it and pass it on to the client.
Is this possible with TBS?

many thanks in advance!
By: Skrol29
Date: 2017-02-17
Time: 08:46

Re: catch error messages before it reaches client

Hi,

TBS has no common error handler for now because of history reasons.
BUt there a solution: if you set « TBS->SetOptions('noerr', true) », then no error message is displayed, the number of error is given by « $TBS->ErrCount » and the errors messages are given by « $TBS->ErrMsg ».
So you can check at the end of the merge if there is any error.