www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Ideas to reduce error message size?

reply Paolo Invernizzi <paolo.invernizzi gmail.com> writes:
Hello everybody,

If a compilation error is thrown with CTFE involved, the 'called 
from here' is like:

  ```
src/api3.d(2010): Error: uncaught CTFE exception 
`object.Exception("42703: column \"system_timestamp_ms\" does not 
exist. SQL: select coalesce(count(system_timestamp_ms),0) from 
dev_samples where device_id = $1")`
src/api3.d(39):        thrown from here
src/api3.d(49):        called from here: 
`checkSql(Schema("public",  <snip **BAZILLIONS of lines**>
src/dget/db.d(276): Error: template instance 
`api3.forgeSqlCheckerForSchema!(Schema("public", <snip 
**BAZILLIONS of lines**>  error instantiating
  ```

Simple question: there's a pattern to reduce the outputted stuff 
someway? Everything is related to a single struct, `Schema`, used 
during compile time stuff.

Thank you,
Paolo
Aug 30 2023
parent Nick Treleaven <nick geany.org> writes:
On Wednesday, 30 August 2023 at 09:24:21 UTC, Paolo Invernizzi 
wrote:
 src/api3.d(49):        called from here: 
 `checkSql(Schema("public",  <snip **BAZILLIONS of lines**>
 src/dget/db.d(276): Error: template instance 
 `api3.forgeSqlCheckerForSchema!(Schema("public", <snip 
 **BAZILLIONS of lines**>  error instantiating
  ```
The compiler could limit the call expression to a few lines unless the verbose flag is passed. A similar problem exists when calling a function literal which errors, the whole body is printed which can be long.
Aug 31 2023