1 package com.atlassian.plugin.webresource;
2
3 import java.io.IOException;
4 import java.io.OutputStream;
5
6
7
8
9
10
11
12 class TryCatchJsResourceContentAnnotator implements ResourceContentAnnotator
13 {
14 @Override
15 public void before(OutputStream stream) throws IOException
16 {
17 stream.write("try {\n".getBytes());
18 }
19
20 @Override
21 public void after(OutputStream stream) throws IOException
22 {
23 stream.write(("\n} catch (err) {\n if (console && console.log && console.error) {\n console.log(\"Error running batched script.\");\n console.error(err);\n }\n}\n\n").getBytes());
24 }
25 }