Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

minfo.d is no longer throwing Errors #2795

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions src/rt/minfo.d
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct ModuleGroup
// release mode.
if (distance[target] != curdist)
{
throw new Error("internal error printing module cycle");
assert(0, "internal error printing module cycle");
}

// determine the path. This is tricky, because we have to
Expand Down Expand Up @@ -196,7 +196,7 @@ struct ModuleGroup
break;
default:
// invalid cycle handling option.
throw new Error("DRT invalid cycle handling option: " ~ cycleHandling);
assert(0, "DRT invalid cycle handling option: " ~ cycleHandling);
}

debug (printModuleDependencies)
Expand Down Expand Up @@ -368,7 +368,8 @@ struct ModuleGroup

string errmsg = "";
buildCycleMessage(idx, midx, (string x) {errmsg ~= x;});
throw new Error(errmsg, __FILE__, __LINE__);
assert(0, errmsg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right though ? That's an user-facing message, not a programming error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert gives a user-facing message. Besides, being unable to run the constructors is a programming error.


case ignore:
break;
case print:
Expand Down
2 changes: 1 addition & 1 deletion test/cycles/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))

$(ROOT)/cycle_ignore.done: RETCODE=0
$(ROOT)/cycle_ignore.done: LINES=0
$(ROOT)/cycle_abort.done: RETCODE=1
$(ROOT)/cycle_abort.done: RETCODE=4
$(ROOT)/cycle_abort.done: LINES=7
$(ROOT)/cycle_print.done: RETCODE=0
$(ROOT)/cycle_print.done: LINES=6
Expand Down