/**
 * Module dependencies
 */ import { HttpError } from './http-error' ; export class SolrError extends HttpError { public statusCode : any ; constructor ( req , res , htmlMessage ) { super ( req , res , htmlMessage ) ; this . name = this . constructor . name ; if ( 'captureStackTrace' in Error ) { Error . captureStackTrace ( this , this . constructor ) ; } let message = '' ; if ( htmlMessage ) { const matches = htmlMessage . match ( /<pre>([\s\S]+)<\/pre>/ ) ; message = decode ( ( matches || [ '' , htmlMessage ] ) [ 1 ] . trim ( ) ) ; } this . statusCode = res . statusCode ; this . message = message ?? res . statusMessage ; } } param { String } str return { String } api function decode ( str ) { return str . replace ( /&amp;/g , '&' ) . replace ( /&lt;/gm , '<' ) . replace ( /&gt;/gm , '>' ) . replace ( /&apos;/gm , "'" ) . replace ( /&quot;/gm , '"' ) ; }