Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/create-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ function createServer (argv, app) {
try {
key = fs.readFileSync(argv.sslKey)
} catch (e) {
throw new Error('Can\'t find SSL key in ' + argv.sslKey)
throw new Error('Can\'t find SSL key in ' + argv.sslKey, { cause: e })
}

let cert
try {
cert = fs.readFileSync(argv.sslCert)
} catch (e) {
throw new Error('Can\'t find SSL cert in ' + argv.sslCert)
throw new Error('Can\'t find SSL cert in ' + argv.sslCert, { cause: e })
}

const credentials = Object.assign({
Expand Down
7 changes: 4 additions & 3 deletions lib/ldp.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ class LDP {
const container = itemUrl.endsWith('/')
try {
const testUrl = container ? itemUrl.slice(0, -1) : itemUrl + '/'
const { path: testPath } = await this.resourceMapper.mapUrlToFile({ url: testUrl })
const mapped = await this.resourceMapper.mapUrlToFile({ url: testUrl })
testPath = mapped.path
testName = container ? fs.lstatSync(testPath).isFile() : fs.lstatSync(testPath).isDirectory()
} catch (err) {
testName = false
Expand Down Expand Up @@ -437,7 +438,7 @@ class LDP {
const owner = await graph.statementsMatching($rdf.sym(webId), SOLID('account'), $rdf.sym(rootUrl + '/'))
return owner.length
} catch (error) {
throw new Error(`Failed to get owner from ${rootUrl}/.meta, got ` + error)
throw new Error(`Failed to get owner from ${rootUrl}/.meta, got ` + error, { cause: error })
}
}

Expand Down Expand Up @@ -697,7 +698,7 @@ class LDP {
}

await withLock(path, async () => {
let originalData = ''
let originalData

try {
originalData = await promisify(fs.readFile)(path, { encoding: 'utf8' })
Expand Down
2 changes: 1 addition & 1 deletion lib/models/account-manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AccountManager {
userConfig.webId = userConfig.webId || this.accountWebIdFor(userConfig.username)
} catch (err) {
if (err.message === 'Cannot construct uri for blank account name') {
throw new Error('Username or web id is required')
throw new Error('Username or web id is required', { cause: err })
} else {
throw err
}
Expand Down
2 changes: 1 addition & 1 deletion lib/services/email-service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class EmailService {
const required = require(cjsTemplateFile)
return required
} catch (err2) {
throw new Error('Cannot find email template: ' + templateFile)
throw new Error('Cannot find email template: ' + templateFile, { cause: err2 })
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export async function getQuota (root, serverUri) {
try {
$rdf.parse(prefs, graph, storageUri, 'text/turtle')
} catch (error) {
throw new Error('Failed to parse serverSide.ttl, got ' + error)
throw new Error('Failed to parse serverSide.ttl, got ' + error, { cause: error })
}
return Number(graph.anyValue($rdf.sym(storageUri), nsObj.solid('storageQuota'))) || Infinity
}
Expand Down
Loading
Loading