Currently if you start bitcoind with multiple chain options, we will fail with an assertion rather than exit gracefully. i.e:
src/bitcoind -testnet -regtest
************************
EXCEPTION: St13runtime_error
Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.
bitcoin in AppInit()
Assertion failed: (globalChainBaseParams), function BaseParams, file chainparamsbase.cpp, line 36.
Rather than throw in GetChainName(), just return the string and throw in CreateBaseChainParams() which will fail more gracefully. i.e:
src/bitcoind -testnet -regtest
Error: CreateBaseChainParams: Unknown chain: Invalid combination of -regtest, -signet, -testnet or -chain.
src/bitcoind -chain=not_a_chain
Error: CreateBaseChainParams: Unknown chain: not_a_chain.
One of the followups from #15934.