Commit 037c01b7 authored by Anton's avatar Anton

Fix PBA response in case of unconfigured endpoint

parent 9dd5bc72
Pipeline #19660 passed with stage
in 1 minute and 23 seconds
...@@ -24,13 +24,13 @@ class PBA extends TinyEmitter { ...@@ -24,13 +24,13 @@ class PBA extends TinyEmitter {
async getPiecesHandler (req, res) { async getPiecesHandler (req, res) {
const result = await this._performRequest('pieces') const result = await this._performRequest('pieces')
if (result) this._response(req, res, result.pieces) if (result) this._response(req, res, result.pieces)
else this._errorResponse({}, 503, 'PBA vocabularies not available') else this._errorResponse(res, 503, 'PBA vocabularies not available')
} }
async getTitlesForPieceHandler (req, res) { async getTitlesForPieceHandler (req, res) {
const result = await this._performRequest(`titles/${req.params.piece_id}`) const result = await this._performRequest(`titles/${req.params.piece_id}`)
if (result) this._response(req, res, result.titles) if (result) this._response(req, res, result.titles)
else this._errorResponse({}, 503, 'PBA vocabularies not available') else this._errorResponse(res, 503, 'PBA vocabularies not available')
} }
_response (req, res, data = {}) { _response (req, res, data = {}) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment