# Try-catch structure problem

**URL:** <https://discourse.processing.org/t/try-catch-structure-problem/18437>\
**Category:** Libraries\
**Created:** [March 6, 2020, 3:39am UTC](https://discourse.processing.org/t/try-catch-structure-problem/18437 "2020-03-06T03:39:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnC](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JohnC](https://discourse.processing.org/u/JohnC)\
**Post date:** [March 6, 2020, 3:39am UTC](https://discourse.processing.org/t/try-catch-structure-problem/18437/1 "2020-03-06T03:39:44Z")

</div>

here is a minimise code

```auto
import processing.video.*;
Movie m;
boolean error = false;
void setup(){
  size(200,200);
}

void draw(){
  background(0);
  if (error){
    background(255,0,0);
  }
}

void keyPressed(){
  if (key == 'h'){
    String tem= key+".mp4";
    try{
      m = new Movie (this,tem);
    }
    catch (Exception e){
      error = true;
      print("catch is run");
    }
  }
}

```

in this, the code in catch will be run once  
and the whole sketch frozen.  
How can I make the sketch continue to run after catch the exception?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 6, 2020, 7:07am UTC](https://discourse.processing.org/t/try-catch-structure-problem/18437/2 "2020-03-06T07:07:15Z")

</div>

Hi John.  
Yes, I also use the try-catch block a lot, and it does not always pass over the error. It seems to me the most obvious error that the file couldn’t be found. So I normally do an ‘if file exists’ check, in those cases. The Processsings example DirectoryList could help how to check the path.
