mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
improves some error messages
This commit is contained in:
parent
86b406ad2e
commit
68d551dc09
@ -69,8 +69,7 @@ async function exec() {
|
||||
consumer,
|
||||
)
|
||||
} catch (e) {
|
||||
Logger.warn("Error on initializeServiceAgreement:", e)
|
||||
process.exit(1)
|
||||
throw new Error(`"Error on initializeServiceAgreement: ${e}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ export function runner(fn: () => Promise<any>) {
|
||||
fn()
|
||||
.then(() => process.exit(0))
|
||||
.catch((e) => {
|
||||
Logger.warn(e)
|
||||
Logger.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import * as EthJsUtils from "ethereumjs-util"
|
||||
import Keeper from "../keeper/Keeper"
|
||||
import Web3Provider from "../keeper/Web3Provider"
|
||||
import Balance from "../models/Balance"
|
||||
import Logger from "../utils/Logger"
|
||||
import OceanBase from "./OceanBase"
|
||||
|
||||
/**
|
||||
@ -57,9 +58,15 @@ export default class Account extends OceanBase {
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
public async requestTokens(amount: number): Promise<number> {
|
||||
await (await Keeper.getInstance())
|
||||
.market
|
||||
.requestTokens(amount, this.id)
|
||||
try {
|
||||
await (await Keeper.getInstance())
|
||||
.market
|
||||
.requestTokens(amount, this.id)
|
||||
} catch (e) {
|
||||
Logger.error(e)
|
||||
throw new Error("Error requesting tokens")
|
||||
|
||||
}
|
||||
return amount
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,6 @@ export default class Ocean {
|
||||
})
|
||||
|
||||
event.listenOnce(async (data) => {
|
||||
|
||||
const sa: ServiceAgreement = new ServiceAgreement(data.returnValues.serviceAgreementId)
|
||||
await sa.payAsset(
|
||||
d.getId(),
|
||||
@ -263,7 +262,6 @@ export default class Ocean {
|
||||
serviceAgreementId,
|
||||
serviceAgreementSignature,
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
Logger.error("Signing ServiceAgreement failed!", err)
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
||||
this.template.fulfillmentOperator,
|
||||
templateOwnerAddress)
|
||||
} catch (e) {
|
||||
Logger.error(e)
|
||||
throw new Error(`Is not possible to setup the agreement template`)
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ export default class WebServiceConnector {
|
||||
private async fetch(url: string, opts: RequestInit): Promise<Response> {
|
||||
const result = await fetch(url, opts)
|
||||
if (!result.ok) {
|
||||
Logger.warn(`Error requesting [${opts.method}] ${url}`)
|
||||
Logger.warn(`Response message: \n${await result.text()}`)
|
||||
Logger.error(`Error requesting [${opts.method}] ${url}`)
|
||||
Logger.error(`Response message: \n${await result.text()}`)
|
||||
throw result
|
||||
}
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user