Usages of moldable exceptions in Glamorous Toolkit
This page gives examples of Moldable exceptions used in Glamorous Toolkit.
AssertionFailure
AssertionFailure
defines a debugging configuration, that at the moment shows a diff view when two strings are compared.
self assert: GtExampleComparisonExceptionWithDebuggingViews new expectedStringForTest equals: GtExampleComparisonExceptionWithDebuggingViews new computedStringForTest
An AssertionFailure that does not involve a comparison does not trigger that error.
self assert: 1 = 2
Warnings
Warning
notifications directly show the message and allow the user to proceed.
Warning signal: 'I am a warning message'
GtPhlowViewTesterObjectValidationFailure
GtPhlowViewTesterObjectValidationFailure
is an assertion failure indicating that there is an error in the view of an object. See How to test phlow views for other examples of views with errors.
self assertObjectPhlowViewsFor: GtPhlowViewWithErrorExamples new.
GtPhlowViewTesterViewValidationFailure
GtPhlowViewTesterViewValidationFailure
indicates that there is an error inside a single view of an object.
GtPhlowViewTester new assertViewOk: (GtPhlowViewWithErrorExamples new gtViewWithFailureInColumnedListFor: GtPhlowView empty)
GtPhlowViewsCollectorSameViewError
GtPhlowViewsCollectorSameViewError
is triggered when building a view if the same view that was given as parameter is returned.
viewBuilder := GtPhlowView empty. viewBuilder basicOn: GtPhlowViewWithErrorExamples new perform: #gtViewWithReturningSameViewFor: withArguments: {viewBuilder}.
Not in all cases can we easily determine the place where the empty view is created.
viewBuilder := GtPhlowView empty. viewBuilder basicOn: GtPhlowViewWithErrorExamples new perform: #gtViewWithReturningIndirectlySameViewFor: withArguments: {viewBuilder}.
BlSingularMatrixError
BlSingularMatrixError
is thrown when trying to inverse a singular (non-invertible or degenerate) matrix.
element := BlElement new size: 0@0; transformDo: [ :t | t scaleBy: 0 . t translateBy: 10@5. t rotateBy: 25. t shearBy: 2@3 ]. element globalPointToLocal: 10@10
ZnTooManyRedirects
ZnTooManyRedirects
error has a debugging action for inceasing the number of redirects and retrying the request.
ZnClient new url: 'https://www.gmail.com'; maxNumberOfRedirects: 3; get
ConnectionTimedOut
The ConnectionTimedOut
error has two debugging actions that make it possible to
- increasing the timeout in the current ZnClient
instance and retry the request,
- continue reading/writing data with a new timeout set.
ZnServer startDefaultOn: 1701. ZnClient new url: ZnServer default localUrl / #echo; timeout: 2; queryAt: #delay put: 10; get
ZnClient errors
The method ZnClient>>#retryExceptionSet
defines a list of exceptions that Zinc handles by doing a retry.
The debugging action GtZnClientFailedRequestRetryDebugAction
offers the possibility to increase the number of allowed retries and retry execution.
client := ZnClient new url: 'https://www.noexistingurl.com'; numberOfRetries: 2; get