Improving error messages.
This commit is contained in:
parent
f09b7bd0e9
commit
c1c372ced8
@ -26,9 +26,9 @@ LeDatabase >> addPageFromMarkdeep: markdeepDocTree [
|
|||||||
page children collect: [ :snippet |
|
page children collect: [ :snippet |
|
||||||
(self hasBlockUID: (snippet uid))
|
(self hasBlockUID: (snippet uid))
|
||||||
ifTrue: [ | existingPage |
|
ifTrue: [ | existingPage |
|
||||||
existingPage := self pages detect: [ :pageTemp |
|
existingPage := self pages detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
||||||
pageTemp includesSnippetUid: snippet uid ].
|
self importErrorMessage: existingPage.
|
||||||
^ self errorCardFor: (self importErrorMessage: existingPage) ]
|
^ self ]
|
||||||
ifFalse: [
|
ifFalse: [
|
||||||
snippet database: self.
|
snippet database: self.
|
||||||
self registerSnippet: snippet ] ].
|
self registerSnippet: snippet ] ].
|
||||||
@ -41,7 +41,7 @@ LeDatabase >> addPageFromMarkdeepUrl: aString [
|
|||||||
|
|
||||||
| page |
|
| page |
|
||||||
page := self detectLocalPageForRemote: aString.
|
page := self detectLocalPageForRemote: aString.
|
||||||
page ifNotNil: [ :arg | self errorCardFor: (self importErrorMessage: page).
|
page ifNotNil: [ :arg | (self importErrorMessage: page).
|
||||||
^ self ].
|
^ self ].
|
||||||
^ self addPageFromMarkdeep: (self docTreeForLink: aString)
|
^ self addPageFromMarkdeep: (self docTreeForLink: aString)
|
||||||
]
|
]
|
||||||
@ -68,27 +68,27 @@ LeDatabase >> errorCardFor: errorMessage [
|
|||||||
keepButton := BrButton new
|
keepButton := BrButton new
|
||||||
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
||||||
beTinySize;
|
beTinySize;
|
||||||
label: 'Keep existing page';
|
label: 'Keep existing local page';
|
||||||
icon: BrGlamorousVectorIcons cancel;
|
icon: BrGlamorousVectorIcons cancel;
|
||||||
action: [ :aButton | ];
|
action: [ :aButton | ];
|
||||||
margin: (BlInsets left: 10).
|
margin: (BlInsets left: 10).
|
||||||
overwriteButton := BrButton new
|
overwriteButton := BrButton new
|
||||||
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
||||||
beTinySize;
|
beTinySize;
|
||||||
label: 'Overwrite page';
|
label: 'Overwrite with remote page';
|
||||||
icon: BrGlamorousVectorIcons edit;
|
icon: BrGlamorousVectorIcons edit;
|
||||||
action: [ :aButton | ];
|
action: [ :aButton | ];
|
||||||
margin: (BlInsets left: 10).
|
margin: (BlInsets left: 10).
|
||||||
backupButton := BrButton new
|
backupButton := BrButton new
|
||||||
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
|
||||||
beTinySize;
|
beTinySize;
|
||||||
label: 'BackUp page';
|
label: 'Backup local page';
|
||||||
icon: BrGlamorousVectorIcons changes;
|
icon: BrGlamorousVectorIcons changes;
|
||||||
action: [ :aButton | ];
|
action: [ :aButton | ];
|
||||||
margin: (BlInsets left: 10).
|
margin: (BlInsets left: 10).
|
||||||
|
|
||||||
errorMessageUI := BrEditor new
|
errorMessageUI := BrEditor new
|
||||||
aptitude: BrGlamorousRegularEditorAptitude new "+ aModeLook;";
|
aptitude: BrGlamorousRegularEditorAptitude new ;
|
||||||
text: errorMessage;
|
text: errorMessage;
|
||||||
vFitContent.
|
vFitContent.
|
||||||
^ { errorMessageUI. keepButton. overwriteButton. backupButton }
|
^ { errorMessageUI. keepButton. overwriteButton. backupButton }
|
||||||
@ -126,22 +126,22 @@ LeDatabase >> importErrorMessage: page [
|
|||||||
id := page uidString.
|
id := page uidString.
|
||||||
message := String streamContents: [ :stream |
|
message := String streamContents: [ :stream |
|
||||||
stream
|
stream
|
||||||
nextPutAll: 'IMPORTATION ERROR: a page with';
|
nextPutAll: 'IMPORTATION ERROR: A page with
|
||||||
nextPut: Character lf;
|
';
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll: ' id: ' , id;
|
nextPutAll: ' id: ' , id;
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll: ' title: ' , page contentAsString;
|
nextPutAll: ' title: ' , page contentAsString;
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll: 'already exists in this database.';
|
nextPutAll: 'already exists in this database and includes overlapping contents';
|
||||||
|
nextPut: Character lf;
|
||||||
|
nextPutAll: 'with the page you are trying to import.';
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll:
|
nextPutAll:
|
||||||
'Please do one of those before retrying this procedure:
|
'Please choose one of the following options to addres the issue:
|
||||||
|
' ].
|
||||||
1) Move the existing page files (.lepiter and .bak) to another (sub)folder.
|
|
||||||
2) Import the page url to another database.' ].
|
|
||||||
self errors at: id put: message
|
self errors at: id put: message
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user