Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Use TruffleError instead of Error while parsing mutually exclusive options #5433

Merged
merged 1 commit into from
Aug 15, 2022
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
12 changes: 11 additions & 1 deletion packages/core/lib/commands/console/run.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
module.exports = async function (options) {
const OS = require("os");
const { Console, excludedCommands } = require("../../console");
const { Environment } = require("@truffle/environment");
const TruffleError = require("@truffle/error");
const commands = require("../commands");
const loadConfig = require("../../loadConfig");

if (options.url && options.network) {
throw new Error("'url' and 'network' are mutually exclusive options");
const message =
"" +
"Mutually exclusive options, --url and --network detected!" +
OS.EOL +
"Please use either --url or --network and try again." +
OS.EOL +
"See: https://trufflesuite.com/docs/truffle/reference/truffle-commands/#console" +
OS.EOL;
throw new TruffleError(message);
}

let config = loadConfig(options);
Expand Down
15 changes: 11 additions & 4 deletions packages/core/lib/commands/debug/run.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
module.exports = async function (options) {
const OS = require("os");
const { promisify } = require("util");
const debugModule = require("debug");
const loadConfig = require("../../loadConfig");
const debug = debugModule("lib:commands:debug");

const { Environment } = require("@truffle/environment");
const TruffleError = require("@truffle/error");
const { CLIDebugger } = require("../../debug");

if (options.url && options.network) {
throw new Error("Url and Network options should not be specified together");
const message =
"" +
"Mutually exclusive options, --url and --network detected!" +
OS.EOL +
"Please use either --url or --network and try again." +
OS.EOL +
"See: https://trufflesuite.com/docs/truffle/reference/truffle-commands/#debug" +
OS.EOL;
throw new TruffleError(message);
}

let config = loadConfig(options);
Expand Down