Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary test on undefined value #854

Merged
Merged
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
6 changes: 0 additions & 6 deletions systemservices/marketplace/src/tasks/getService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import { getService } from "../contracts/service";
export default (contract: Marketplace) => async (inputs: TaskInputs, outputs: TaskOutputs): Promise<void> => {
try {
const service = await getService(contract, inputs.sid)
if (service === undefined) {
return outputs.error({
message: 'service with sid ' + inputs.sid + ' does not exist',
code: 'notFound',
})
}
return outputs.success(service)
}
catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions systemservices/marketplace/src/tasks/isAuthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ export default (

// get version's manifest data
const version = await getServiceVersion(contract, versionHash)
if (version === undefined) {
throw new Error('service with versionHash ' + versionHash + ' does not exist')
}
if (version.manifestData === null) {
throw new Error('could not download manifest of version with hash ' + versionHash)
}
Expand Down
4 changes: 0 additions & 4 deletions systemservices/marketplace/src/tasks/preparePurchase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export default (
try {
// get offer data
const offer = await getServiceOffer(marketplace, inputs.sid, new BigNumber(inputs.offerIndex))
if (offer === undefined) {
throw new Error('Offer with index ' + inputs.offerIndex + ' and sid ' + inputs.sid + ' does not exist')
}

// check user balance
const balance = fromUnit(await token.methods.balanceOf(inputs.from).call())
if (offer.price.isGreaterThan(balance)) {
Expand Down
2 changes: 1 addition & 1 deletion systemservices/marketplace/src/tasks/publishPurchase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default (
await web3.eth.sendSignedTransaction(txs[index])
}
const receipt = await web3.eth.sendSignedTransaction(lastTransaction)
if (receipt === null || receipt.logs === undefined) throw new Error('receipt does not contain logs')
if (receipt.logs === undefined) throw new Error('receipt does not contain logs')
const decodedLog = extractEventFromLogs(web3, marketplace, 'ServicePurchased', receipt.logs)
const event = servicePurchased(decodedLog)
return outputs.success(event)
Expand Down