AmpersandTarski / prototype

Prototype framework that transforms your Ampersand model into a web application
MIT License
1 stars 2 forks source link

Message: Class "Ampersand\Exception\NotDefined\ConceptNotDefined" not found #161

Closed stefjoosten closed 4 months ago

stefjoosten commented 11 months ago

What happened

I imported a spreadsheet, APMlijst.xlsx through an INCLUDE statement in my script. It worked fine. Then, I imported the same spreadsheet into the runtime importer. It failed with the message: Class "Ampersand\Exception\NotDefined\ConceptNotDefined" not found.

image When I opened the mistake (see the screenshot), I got a lot of text that did not help me. I also opened the log file. That didn't help me either. I experimented with the .xlsx file, without luck.

What I expected

I expected some help to diagnose this mistake.

Diagnosis

It took me a journey into the PHP code of ExcelImporter.php to find the cause. I discovered that some of the names of worksheets correspond with the names of interfaces in my Ampersand script. As a result, the ExcelImporter calls parseWorksheetWithIfc instead of parseWorksheet.

Proposed solution

I suggest we build in a more meaningful error message, to save the victims of this mistake a lot of time. Since good error messages are a necessity, I consider this a bug rather than a feature.

Version of ampersand that was used

Steps to reproduce

  1. Write an Ampersand script with an interface named "Diensten"
  2. Write a spreadsheet with a worksheet called "Diensten", ensuring that this imports correctly when INCLUDEd in the script, but not according to the INTERFACE conventions (to reproduce the mistake)
  3. Run the prototype
  4. Import the spreadsheet in the runtime Excel-importer.
Michiel-s commented 4 months ago

Duplicate of #115