Skip to content

Commit 84a972c

Browse files
committed
Refine compile/run error messages
1 parent c5aa4f8 commit 84a972c

File tree

9 files changed

+16
-17
lines changed

9 files changed

+16
-17
lines changed

src/backend/common/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import child_process from 'child_process';
44
const execute = (command, cwd, { stdout = process.stdout, stderr = process.stderr } = {}) => new Promise((resolve, reject) => {
55
if (!cwd) return reject(new Error('CWD Not Specified'));
66
const child = child_process.exec(command, { cwd }, (error, stdout, stderr) => {
7-
if (error) return reject(new Error(stderr));
7+
if (error) return reject(error.code ? new Error(stderr) : error);
88
resolve(stdout);
99
});
1010
if (stdout) child.stdout.pipe(stdout);
@@ -13,4 +13,4 @@ const execute = (command, cwd, { stdout = process.stdout, stderr = process.stder
1313

1414
export {
1515
execute,
16-
};
16+
};

src/backend/controllers/tracers.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ const trace = lang => (req, res, next) => {
2929
const tempPath = getCodesPath(uuid.v4());
3030
fs.outputFile(path.resolve(tempPath, `Main.${lang}`), code)
3131
.then(() => execute(`LANG=${lang} TEMP_PATH=${tempPath} ./bin/compile`, repoPath, { stdout: null, stderr: null })
32-
.catch(error => {
33-
throw new CompileError(error);
34-
}))
32+
.catch(error => Promise.reject(new CompileError(error.message))))
3533
.then(() => execute(`LANG=${lang} TEMP_PATH=${tempPath} ./bin/run`, repoPath, { stdout: null, stderr: null })
36-
.catch(error => {
37-
throw new RuntimeError(error);
38-
}))
34+
.catch(error => Promise.reject(new RuntimeError(error.message))))
3935
.then(() => res.sendFile(path.resolve(tempPath, 'traces.json')))
4036
.catch(next)
4137
.finally(() => fs.remove(tempPath));
@@ -51,4 +47,4 @@ router.route('/java')
5147
router.route('/cpp')
5248
.post(trace('cpp'));
5349

54-
export default router;
50+
export default router;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$font-family-normal: 'Roboto', sans-serif;
2+
$font-family-monospace: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@import "colors";
2-
@import "dimensions";
2+
@import "dimensions";
3+
@import "fonts";

src/frontend/components/App/stylesheet.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body {
1010
}
1111

1212
body {
13-
font-family: 'Roboto', sans-serif;
13+
font-family: $font-family-normal;
1414
-webkit-font-smoothing: subpixel-antialiased;
1515
user-select: none;
1616
color: $color-font;

src/frontend/components/ToastContainer/stylesheet.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
border-radius: 4px;
1414
padding: 16px;
1515
margin: 8px;
16-
font-size: $font-size-large;
17-
white-space: pre-line;
16+
white-space: pre-wrap;
1817
pointer-events: auto;
18+
font-family: $font-family-monospace;
1919

2020
&.success {
2121
border-color: rgb(0, 150, 0);

src/frontend/core/renderers/LogRenderer/stylesheet.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
display: flex;
88
flex-direction: column;
99
overflow-y: auto;
10+
font-family: $font-family-monospace;
1011

1112
.message {
1213
margin: 2px 0;

src/frontend/core/renderers/Renderer/stylesheet.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
display: flex;
88
align-items: center;
99
justify-content: center;
10-
font-family: 'Roboto Mono', monospace;
1110

1211
&:first-child {
1312
border-top: none;
@@ -17,9 +16,9 @@
1716
position: absolute;
1817
top: 0;
1918
left: 0;
20-
background-color: $color-shadow;
19+
background-color: $theme-light;
2120
color: $color-font;
22-
padding: 4px;
21+
padding: 4px 6px;
2322
font-size: $font-size-large;
2423
}
2524
}

src/frontend/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<meta name="theme-color" content="#393939">
1919
<link rel="shortcut icon" href="/favicon.png" type="image/png">
2020
<link rel="manifest" href="/manifest.json">
21-
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,700" rel="stylesheet">
21+
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
2222
</head>
2323
<body>
2424
<div id="root" style="height: 100%"></div>

0 commit comments

Comments
 (0)