mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Improve error messages
This commit is contained in:
parent
520f32ed36
commit
62d6bd7bd9
@ -419,7 +419,7 @@ describe("CosmWasmClient", () => {
|
||||
const client = CosmWasmClient.makeReadOnly(httpUrl);
|
||||
await client.queryContractRaw(nonExistentAddress, configKey).then(
|
||||
() => fail("must not succeed"),
|
||||
error => expect(error).toMatch(`No contract with address ${nonExistentAddress}`),
|
||||
error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -430,10 +430,11 @@ describe("RestClient", () => {
|
||||
expect((myInfo.init_msg as any).beneficiary).toEqual(beneficiaryAddress);
|
||||
|
||||
// make sure random addresses don't give useful info
|
||||
const nonExistentAddress = makeRandomAddress();
|
||||
await client
|
||||
.getContractInfo(beneficiaryAddress)
|
||||
.getContractInfo(nonExistentAddress)
|
||||
.then(() => fail("this shouldn't succeed"))
|
||||
.catch(error => expect(error).toMatch(`No contract with address ${beneficiaryAddress}`));
|
||||
.catch(error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`));
|
||||
});
|
||||
|
||||
describe("contract state", () => {
|
||||
|
@ -311,7 +311,7 @@ export class RestClient {
|
||||
// rest server returns null if no data for the address
|
||||
const info: ContractInfo | null = parseWasmResponse(responseData as WasmResponse);
|
||||
if (!info) {
|
||||
throw new Error(`No contract with address ${address}`);
|
||||
throw new Error(`No contract found at address "${address}"`);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user