Skip to content

Commit

Permalink
Desktop sync setup shows different error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Apr 11, 2022
1 parent d90fe3c commit f29ddba
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ <h2 class="device-title">$i18n{braveSyncChooseDeviceComputerTitle}</h2>
<textarea autofocus class="sync-code-text" value="{{syncCode::input}}"></textarea>
<div class="sync-code-footer">
[[i18n('braveSyncWordCount', syncCodeWordCount_)]]
<template is="dom-if" if="[[isInvalidSyncCode]]">
<div class="invalid-sync-code">
$i18n{braveSyncInvalidSyncCodeTitle}
</div>
</template>
</div>
<template is="dom-if" if="[[isInvalidSyncCode]]">
<div class="invalid-sync-code">
[[syncCodeValidationResult]]
</div>
</template>
</div>

<div slot="button-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Polymer({
value: false,
notify: true
},
syncCodeValidationResult: {
type: String,
value: '',
notify: true
},
syncCodeWordCount_: {
type: Number,
computed: 'computeSyncCodeWordCount_(syncCode)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ <h1>$i18n{braveSyncSetupTitle}</h1>
code-type="{{syncCodeDialogType_}}"
sync-code="{{syncCode}}"
is-invalid-sync-code="{{isInvalidSyncCode_}}"
sync-code-validation-result="{{syncCodeValidationResult_}}"
on-done="handleSyncCodeDialogDone_"
></settings-brave-sync-code-dialog>
</template>
12 changes: 6 additions & 6 deletions browser/resources/settings/brave_sync_page/brave_sync_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ Polymer({
isInvalidSyncCode_: {
type: Boolean,
value: false,
}
},
syncCodeValidationResult_: {
type: String,
value: '',
}
},

/** @private {?BraveSyncBrowserProxy} */
Expand Down Expand Up @@ -87,13 +91,9 @@ Polymer({
const syncCodeToSubmit = this.syncCode || ''
let success = false
try {
console.log('submitSyncCode_ 001')
success = await this.syncBrowserProxy_.setSyncCode(syncCodeToSubmit)
console.log('submitSyncCode_ 002')
} catch (e) {
console.log('submitSyncCode_ 003++, e=', e)
console.error("Error setting sync code")
alert(e)
this.syncCodeValidationResult_ = e
success = false
}
this.isSubmittingSyncCode_ = false
Expand Down

0 comments on commit f29ddba

Please sign in to comment.