WASM reactive UI framework for Go: - reactive/ - Signal[T], Effect, Runtime - ui/ - Button, Text, Input, View, Canvas, SVG components - navigation/ - Router, guards, history management - auth/ - OIDC client for WASM applications - host/ - Static file server Extracted from arcadia as open-source component. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
36
ui/canvas_errors.go
Normal file
36
ui/canvas_errors.go
Normal file
@@ -0,0 +1,36 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package ui
|
||||
|
||||
import "log"
|
||||
|
||||
// CanvasWarning represents a type of canvas warning
|
||||
type CanvasWarning int
|
||||
|
||||
const (
|
||||
WarnItemNotFound CanvasWarning = iota
|
||||
WarnConnectionNotFound
|
||||
WarnInvalidOperation
|
||||
WarnSelfConnection
|
||||
WarnMissingCallback
|
||||
)
|
||||
|
||||
// warningNames maps warning types to human-readable names
|
||||
var warningNames = map[CanvasWarning]string{
|
||||
WarnItemNotFound: "ItemNotFound",
|
||||
WarnConnectionNotFound: "ConnectionNotFound",
|
||||
WarnInvalidOperation: "InvalidOperation",
|
||||
WarnSelfConnection: "SelfConnection",
|
||||
WarnMissingCallback: "MissingCallback",
|
||||
}
|
||||
|
||||
// LogCanvasWarning logs a warning for recoverable canvas issues.
|
||||
// These are situations where the operation cannot complete but the
|
||||
// application can continue safely.
|
||||
func LogCanvasWarning(warn CanvasWarning, format string, args ...any) {
|
||||
name := warningNames[warn]
|
||||
if name == "" {
|
||||
name = "Unknown"
|
||||
}
|
||||
log.Printf("[Canvas %s] "+format, append([]any{name}, args...)...)
|
||||
}
|
||||
Reference in New Issue
Block a user