Skip to content

Commit

Permalink
A little cleanup in presentation of inline errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Nov 19, 2024
1 parent 680245b commit 020969e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected void appendChildrenToResponse( NGResponse response, NGContext context
child.appendToResponse( response, context );
}
catch( UnknownKeyException e ) {
new NGErrorMessageElement( "Unknown key", "Borka borka", e.getMessage() ).appendToResponse( response, context );
new NGErrorMessageElement( "Unknown key", child.getClass().getSimpleName(), e.getMessage() ).appendToResponse( response, context );
}

if( appendElementTreeDebugInfo ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public NGElementNotFoundElement( final String type ) {
@Override
public void appendToResponse( NGResponse response, NGContext context ) {
String s = """
<a href="%s" style="padding: 10px; margin: 10px; border: 2px solid rgba(50,50,200,0.6); box-shadow: 4px 4px 1px red; background-color: rgba(0,0,200,0.5); border-radius: 4px; text-decoration: none; color: white">
<a href="%s" style="display: inline-block; padding: 10px; margin: 10px; border: 2px solid rgba(50,50,200,0.6); box-shadow: 4px 4px 1px red; background-color: rgba(0,0,200,0.5); border-radius: 4px; text-decoration: none; color: white">
Can't find an element/component '<strong>%s</strong>'. Would you like to create it?
</a>
""".formatted( context.componentActionURL() + "?elementName=" + _type, _type );
Expand Down
6 changes: 5 additions & 1 deletion ng-appserver/src/main/java/x/junk/NGErrorMessageElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public NGErrorMessageElement( final String type, final String heading, final Str
@Override
public void appendToResponse( NGResponse response, NGContext context ) {
response.appendContentString( """
<span style="display: inline-block; margin: 10px; padding: 10px; color:white; background-color: rgba(255,100,100,0.5); border: 1px solid red; border-radius: 5px; box-shadow: 5px 5px 0px rgba(0,0,200,0.8); font-size: 12px;">%s<br><span style="font-size: 16px"><strong>%s</strong><br>%s</span>
<span style="display: inline-block; margin: 10px; padding: 10px; color:white; background-color: rgba(255,100,100,0.5); border: 1px solid red; border-radius: 5px; box-shadow: 5px 5px 0px rgba(0,0,200,0.8); font-size: 12px;">
%s<br>
<span style="font-size: 16px"><strong>%s</strong></span><br>
%s
</span>
""".formatted( _type, _heading, _message ) );
}
}

0 comments on commit 020969e

Please sign in to comment.