Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
habdelra committed Nov 27, 2024
1 parent e1de382 commit d223d3c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 58 deletions.
55 changes: 0 additions & 55 deletions packages/host/app/components/operator-mode/code-submode.gts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
type ResolvedCodeRef,
PermissionsContextName,
} from '@cardstack/runtime-common';
// import { SerializedError } from '@cardstack/runtime-common/error';
import { isEquivalentBodyPosition } from '@cardstack/runtime-common/schema-analysis-plugin';

import RecentFiles from '@cardstack/host/components/editor/recent-files';
Expand Down Expand Up @@ -311,58 +310,6 @@ export default class CodeSubmode extends Component<Signature> {
return null;
}

// private get fileErrorMessages(): string[] {
// if (this.isCard) {
// if (this.cardResource.cardError) {
// try {
// return this.card
// let error = this.cardResource.cardError;

// // if (error.responseText) {
// // let parsedError = JSON.parse(error.responseText);

// // handle instance errors
// if (parsedError.errors.find((e: any) => e.message)) {
// return parsedError.errors.map((e: any) => e.message);
// }

// // otherwise handle module errors
// let allDetails = parsedError.errors
// .concat(
// ...parsedError.errors.map(
// (e: SerializedError) => e.additionalErrors,
// ),
// )
// .map((e: SerializedError) => e.detail);

// // There’s often a pair of errors where one has an unhelpful prefix like this:
// // cannot return card from index: Not Found - http://test-realm/test/non-card not found
// // http://test-realm/test/non-card not found

// let detailsWithoutDuplicateSuffixes = allDetails.reduce(
// (details: string[], currentDetail: string) => {
// return [
// ...details.filter(
// (existingDetail) => !existingDetail.endsWith(currentDetail),
// ),
// currentDetail,
// ];
// },
// [],
// );

// return detailsWithoutDuplicateSuffixes;
// }
// } catch (e) {
// console.log('Error extracting card preview errors', e);
// return [];
// }
// }
// }

// return [];
// }

private get currentOpenFile() {
return this.operatorModeStateService.openFile.current;
}
Expand Down Expand Up @@ -855,12 +802,10 @@ export default class CodeSubmode extends Component<Signature> {

<hr class='preview-error' />

{{!-- {{#each this.fileErrorMessages as |error|}} --}}
<pre
class='preview-error'
data-test-card-preview-error
>{{this.cardResource.cardError.message}}</pre>
{{!-- {{/each}} --}}
</div>
</div>
{{else if this.fileIncompatibilityMessage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ export default class InteractSubmode extends Component<Signature> {
}

private close = task(async (item: StackItem) => {
// TODO test that a card error stack item can be closed
if (item.cardError) {
this.operatorModeStateService.trimItemsFromStack(item);
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/host/app/components/operator-mode/stack-item.gts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export default class OperatorModeStackItem extends Component<Signature> {
private subscribeToCard = task(async () => {
await this.args.item.ready();
// TODO how do we make sure that this is called after the error is cleared?
// Address this as part of SSE support for card errors
if (!this.cardError) {
this.subscribedCard = this.card;
let api = this.args.item.api;
Expand Down Expand Up @@ -610,7 +611,6 @@ export default class OperatorModeStackItem extends Component<Signature> {
data-test-stack-card-header
/>
<div class='stack-item-content card-error' data-test-card-error>
{{! TODO confirm that we render this in edit format of the stack item !}}
{{#if this.lastKnownGoodHtml}}
<this.lastKnownGoodHtml />
{{else}}
Expand Down
2 changes: 1 addition & 1 deletion packages/host/app/resources/card-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class CardResource extends Resource<Args> {
return;
}
realmSubscribers.set(this, {
// TODO HASSAN NEXT TASK: FIGURE OUT HOW TO GO IN AN OUT OF ERRORS VIA SSE
// TODO figure out how to go in an out of errors via SSE
unsubscribe: this.messageService.subscribe(
realmURL.href,
({ type, data: dataStr }) => {
Expand Down

0 comments on commit d223d3c

Please sign in to comment.