This site requires JavaScript, please enable it in your browser!
Greenfoot back
Roshan123
Roshan123 wrote ...

2021/9/17

Bug in website (i think so..)

Roshan123 Roshan123

2021/9/17

#
I posted it before but now i just wanna ask that is it possible to use try catch in every class. I don't have any idea where will i write and wether its gonna work or not. I don't even know which class is causing the problem in website
danpost danpost

2021/9/17

#
Roshan123 wrote...
is it possible to use try catch in every class
There should be no need to write a try-catch in every class (although, it should not be a problem in using it in multiple classes). In fact, about the only time you would need it would be when doing file operations (opening, reading or writing operations). True, there are other instances where you might use a try-catch, but it is probably the case that in most of your cases, qualifying the code with some if conditions would be enough to eliminate the need for its use.
Roshan123 Roshan123

2021/9/17

#
danpost wrote...
qualifying the code with some if conditions would be enough to eliminate the need for its use.
Thanks, finally found the problem and I think(i have tested in website but still in doubt) its RedBotText class, line 13 & 14 is causing the problem. After removing it, it started working normally but the thing is that i need to change the line inorder to get rid of the errors and i want the exact same implementation. I don't know what will i do
Roshan123 Roshan123

2021/9/17

#
If u wanna check how its working on app, then click here Line 13 and 14 is not at all working in website as compared to app And now the scenario is no more stopping in website becaz i used try catch block. If i will remove then it will again cause trouble in website and not in app Will i use addedToWorld in redBotText class?
danpost danpost

2021/9/18

#
Roshan123 wrote...
Line 13 and 14 is not at all working in website as compared to app
Try changing line 14 to:
setImage((GreenfootImage)null);
or
setImage(new GreenfootImage(1, 1));
and removing the try-catch.
Roshan123 Roshan123

2021/9/18

#
danpost wrote...
setImage(new GreenfootImage(1, 1));
and removing the try-catch.
Thanks, 2nd one worked perfectly
You need to login to post a reply.