@rmlio/rmlmapper-java-wrapper
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -8,2 +8,7 @@ # Changelog | ||
## [0.0.3] - 2019-05-16 | ||
### Added | ||
- Return log as part of an error when RMLMapper execution fails. | ||
## [0.0.2] - 2019-05-13 | ||
@@ -15,2 +20,3 @@ | ||
[0.0.3]: https://github.com/RMLio/yarrrml-parser/compare/v0.0.2...v0.0.3 | ||
[0.0.2]: https://github.com/RMLio/yarrrml-parser/compare/v0.0.1...v0.0.2 |
@@ -31,2 +31,22 @@ /** | ||
}); | ||
it('Invalid mapping', async () => { | ||
const wrapper = new RMLMapperWrapper(rmlmapperPath, tempFolderPath, true); | ||
const rml = fs.readFileSync('./test/tc02/mapping.ttl', 'utf-8'); | ||
const sources = { | ||
'student.csv': fs.readFileSync('./test/tc02/student.csv', 'utf-8') | ||
}; | ||
let error; | ||
try { | ||
await wrapper.execute(rml, sources, false, true); | ||
} catch (err) { | ||
error = err; | ||
} | ||
assert.strictEqual(error === null, false); | ||
assert.strictEqual(error.message, `Error while executing the rules.`); | ||
assert.strictEqual(error.log.indexOf('No Triples Maps found.') !== -1, true); | ||
}); | ||
}); |
@@ -68,41 +68,43 @@ /** | ||
if (stderr) { | ||
console.error(stderr); | ||
} | ||
const err = new Error(`Error while executing the rules.`); | ||
err.log = stderr; | ||
reject(err); | ||
} else { | ||
fs.readFile(outputFile, 'utf8', async (outputErr, output) => { | ||
if (outputErr) { | ||
outputErr.message = `Error while reading output file '${outputFile}'`; | ||
reject(outputErr); | ||
} else { | ||
if (asQuads) { | ||
output = await strToQuads(output); | ||
} | ||
fs.readFile(outputFile, 'utf8', async (outputErr, output) => { | ||
if (outputErr) { | ||
outputErr.message = `Error while reading output file '${outputFile}'`; | ||
reject(outputErr); | ||
} else { | ||
if (asQuads) { | ||
output = await strToQuads(output); | ||
} | ||
if (generateMetadata) { | ||
fs.readFile(metadataFile, 'utf8', async (metadataErr, metadata) => { | ||
if (metadataErr) { | ||
metadataErr.message = `Error while reading output file '${metadataFile}'`; | ||
reject(metadataErr); | ||
} else { | ||
if (asQuads) { | ||
metadata = await strToQuads(metadata); | ||
} | ||
if (generateMetadata) { | ||
fs.readFile(metadataFile, 'utf8', async (metadataErr, metadata) => { | ||
if (metadataErr) { | ||
metadataErr.message = `Error while reading output file '${metadataFile}'`; | ||
reject(metadataErr); | ||
} else { | ||
if (asQuads) { | ||
metadata = await strToQuads(metadata); | ||
resolve({output, metadata}); | ||
} | ||
}); | ||
} else { | ||
resolve({output}); | ||
} | ||
} | ||
resolve({output, metadata}); | ||
if (self.removeTempFolders) { | ||
fs.remove(processDir, err => { | ||
if (err) { | ||
err.message = `Unable to remove temp folder "${processDir}.`; | ||
reject(err) | ||
} | ||
}); | ||
} else { | ||
resolve({output}); | ||
} | ||
} | ||
if (self.removeTempFolders) { | ||
fs.remove(processDir, err => { | ||
if (err) { | ||
err.message = `Unable to remove temp folder "${processDir}.`; | ||
reject(err) | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
@@ -109,0 +111,0 @@ } |
{ | ||
"name": "@rmlio/rmlmapper-java-wrapper", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A JavaScript wrapper around the Java RMLMapper.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13005
13
233