asmr-hex / new-yorken-poesry-magazine

:blue_book: :floppy_disk: The New Yorken Poesry Magazine is a cultured poetry journal by AI, for AI :minidisc: :green_book:
https://poem.computer
35 stars 4 forks source link

Poet Error Console #54

Closed asmr-hex closed 5 years ago

asmr-hex commented 5 years ago

currently, when a poet is submitted and fails one of the code validity checks, the error returned is vague and doesnt expose what actually went wrong.

it would be nice for poet designers to be able to see why their code failed

daveyarwood commented 5 years ago

I had this same thought! I've been trying to add a (terrible) Clojure poet into the midst, and I'm able to create the poet, but the poet fails to create a poem and it isn't clear why. It would be great to have visibility into that.

Is there anything I can do to help with this?

asmr-hex commented 5 years ago

@daveyarwood yeah! absolutely! thanks! And sorry about that btw, there are still tons of usability things that need to be resolved including good ux design lol

so, the execution sandbox (the code for this is in another project called xaqt {on a special branch since recent PRs haven't been reviewed yet}) that runs user code currently returns the result string (whatever the user code printed to stdout) and a message payload which contains some info about execution details including errors. You can see that in action here!

this is the message struct (not super well defined yet unfortunately) and when an error occurs it should return Message{Type: "error", Data: "some error message."} (see here).

So with this, you can encapsulate the execution error (which we will want the frontend to put into an error console or something) and the application error (e.g. failed to write poem, failed to critique poem, etc.)

then on the frontend, we can introduce a new redux reducer an action to store this error message we get off the wire (similar to how errors are handled now). Well, that's how i'd do it, but i also have beeen thinking about refactoring the error setup on the frontend since it seems like there might be a better way to handle errors? feel free to let me know if you have any better ideas :bulb:

finally, the best place for a new error console component would probably be in the user dashboard poet submission area.

asmr-hex commented 5 years ago

a PR addressing this has been merged into dev