aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-12 10:39:57 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-12-12 10:39:57 +0100
commitce184032e802efd38679fe14ba655db23f79cdb2 (patch)
treeff9bfcb41cd5ed77d8434cad325257d7f95c0bd7
parentd10427f782a4a971e3d42af14ca8ca318ce27296 (diff)
WebApp: Provide a very simple way to report an error..
-rw-r--r--WebApp.st45
1 files changed, 35 insertions, 10 deletions
diff --git a/WebApp.st b/WebApp.st
index 95eeb0f..0e0bb34 100644
--- a/WebApp.st
+++ b/WebApp.st
@@ -77,7 +77,38 @@ Iliad.ILWidget subclass: PhoneConfigWidget [
]
]
-Iliad.ILWidget subclass: LUWidget [
+Iliad.ILWidget subclass: ErrorWidget [
+ | reason |
+
+ ErrorWidget class >> initWith: anError [
+ ^ self new
+ reason: anError;
+ yourself
+ ]
+
+ reason: aReason [
+ reason := aReason.
+ ]
+
+ contents [
+ ^ [:e | e text: reason ]
+ ]
+]
+
+Iliad.ILWidget subclass: ProcedureWidget [
+ runProcedure: aBlock name: aName[
+ | proc |
+ [
+ proc := aBlock value.
+ proc run.
+ self session procedures add: proc.
+ ] on: Exception do: [:e |
+ self lightbox: (ErrorWidget initWith: aName, ' could not be started.')
+ ]
+ ]
+]
+
+ProcedureWidget subclass: LUWidget [
contents [
^ [:e |
e a
@@ -87,14 +118,11 @@ Iliad.ILWidget subclass: LUWidget [
]
doLU [
- | lu |
- lu := self application gsmServer doLU: self session gsmConfig.
- lu run.
- self session procedures add: lu.
+ self runProcedure: [self application gsmServer doLU: self session gsmConfig] name: 'LU'
]
]
-Iliad.ILWidget subclass: CallWidget [
+ProcedureWidget subclass: CallWidget [
contents [
^[:e |
e form build: [:form |
@@ -104,10 +132,7 @@ Iliad.ILWidget subclass: CallWidget [
]
placeCall: aNumber [
- | call |
- call := self application gsmServer doCallNumber: self session gsmConfig.
- call run.
- self session procedures add: call.
+ self runProcedure: [self application gsmServer doCallNumber: self session gsmConfig] name: 'Call'
]
]