Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error Log

Hi

Is there a way that you can trap any run time BrightScript errors and write them to a log so you see the same information you get when debuging with Telnet?

Reason for asking..

I'm just wondering what happens if a channel is released if an error/crash happens for a user - you would get a complaint but nothing to go on to help fix it?

If you could trap and log any error (perhaps to your own web site with a URL call?) at least you'd know what caused it?
0 Kudos
9 REPLIES 9
Komag
Roku Guru

Re: Error Log

You could code in places to send a ton of "diagnostic" information periodically, then at least if you got a user with a crash or problem you would have something, not the official Brightscript errors but some information.
0 Kudos
TheEndless
Channel Surfer

Re: Error Log

There's nothing (realistic) built into BrightScript. Roku does get crash dumps for crashing channels, so if you're getting a lot of reports, it may be possible to get them to generate a report for you.

I say "realistic" because technically you could use the Run and/or Eval functions to run code that will allow you to capture errors without crashing, but I wouldn't recommend that.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Error Log

Thanks - just thinking back to when I used to write Basic years ago - there was an "On Error" function you could use.

So there's nothing like that in Brightscript?
0 Kudos
TheEndless
Channel Surfer

Re: Error Log

"NewbyDeveloper" wrote:
Thanks - just thinking back to when I used to write Basic years ago - there was an "On Error" function you could use.

So there's nothing like that in Brightscript?

Unfortunately not.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Error Log

Thanks for taking time to reply.

Just out of interest.... scouring the net I found some ROKU PDF that refers to Brightsign BrightScript....

and it has this in....which doesn't work .... but just adds to the confusion I guess .... an Older version of Brightscript perhaps???

ON ERROR GOTO line number
When the Interpreter encounters any kind of error in your program, it normally breaks out of execution and
prints an error message. With ON ERROR GOTO, you can set up an error-trapping routine, which will allow
your program to "recover" from an error and continue, without any break in execution. Normally you have a
particular type of error in mind when you use the ON ERROR GOTO statement. For example, suppose your
program performs some division operations and you have not ruled out the possibility of division by zero.
You might want to write a routine to handle a division-by-zero error, and then use ON ERROR GOTO to
branch to that routine when such an error occurs.
Example:
5 ON ERROR GOTO 100
10 C = 1/0
The error handling routine must be terminated by a RESUME statement. See RESUME.
0 Kudos
TheEndless
Channel Surfer

Re: Error Log

"NewbyDeveloper" wrote:
Just out of interest.... scouring the net I found some ROKU PDF that refers to Brightsign BrightScript....

and it has this in....which doesn't work .... but just adds to the confusion I guess .... an Older version of Brightscript perhaps???

Not an older version of BrightScript.. a different version of BrightScript for the BrightSign line of products.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
SolveLLC
Visitor

Re: Error Log

This would be very helpful. I'm introducing some code that previously crashed under certain circumstances from external data that I can't control. It would be great if we could have some sort of reporting on crash.
0 Kudos
tim_beynart
Channel Surfer

Re: Error Log

Try... catch sure would be nice, right? *sigh*
We use tons of if/then and remote calls to Splunk to log the predictable failures, but that's not exactly the same thing as exception handling.
0 Kudos
JesUltra
Streaming Star

Re: Error Log, new methods available since Roku OS 9.4 / 13

For the benefit of other people finding this thread, I would like to state that on top of the actual TRY / CATCH which was added in Roku OS 9.4, starting with version 13, we now also have GetLastExitInfo(), that allows your channel to get the last 20 log messages along with other information about previous crashes, which it could then use to upload to your servers.

Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.