File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -103,17 +103,9 @@ function openInitialSession(
103103 if ( props . initialSession ) {
104104 const { document, session } = props . initialSession
105105 if ( baseVersionEtag && baseVersionEtag !== document . baseVersionEtag ) {
106- throw new Error (
106+ throw new ConflictError (
107107 'Base version etag did not match when opening initial session.' ,
108108 )
109- // We need to handle dirty documents differently from 'clean' ones.
110- // For clean ones we need to
111- // * call .clearData() on the provider
112- // * reinitialize the editing session - maybe by reloading the component.
113- // In order to handle the dirty state - i.e. a conflict properly we'd need to:
114- // * fetch the file content.
115- // * throw the same exception as a 409 response.
116- // * include the file content as `outsideChange` in the error.
117109 }
118110 const connection = {
119111 documentId : document . id ,
@@ -126,3 +118,13 @@ function openInitialSession(
126118 return { connection, data : props . initialSession }
127119 }
128120}
121+
122+ /**
123+ * Mimic axios error for a conflict while creating the session.
124+ *
125+ * This will be emitted from the SyncService
126+ * and trigger conflict handling in Editor.vue
127+ */
128+ class ConflictError extends Error {
129+ response = { status : 412 }
130+ }
You can’t perform that action at this time.
0 commit comments