Skip to content

Commit af57ad2

Browse files
committed
Forward upstream reputation errors correctly
1 parent 76861a5 commit af57ad2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/reputation-miner/bin/forked.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,19 @@ async function main() {
7979
const { data } = await axios.get(`http://localhost:${3001}/${req.originalUrl}`);
8080
res.send(data);
8181
} catch (e) {
82-
console.log('Local reputation request failed, try upstream URL:');
82+
console.log('Local reputation request failed, trying upstream URL:');
8383
// If the local oracle fails, query the upstream oracle.
8484
console.log(`${process.env.REPUTATION_URL}/${req.originalUrl}`)
8585
try {
8686

8787
const { data } = await axios({
8888
url: `${process.env.REPUTATION_URL}/${req.originalUrl}`,
89-
responseType: "stream",
9089
});
9190

9291
res.send(data);
9392
} catch (e2) {
94-
console.log('Upstream reputation request failed');
95-
res.status(500).send(e2);
93+
console.log('Upstream reputation request failed, forwarding result');
94+
res.status(e2.response.status).send(await e2.response.data);
9695
}
9796
}
9897
});

0 commit comments

Comments
 (0)