Skip to content

Commit

Permalink
Component validation error is a warning (#5731)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalint authored May 23, 2024
1 parent 8adbee6 commit 8197242
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe('registered property controls', () => {
fileName: '/utopia/components.utopia.js',
message: "Validation failed: Component registered for key 'Card' is undefined",
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -625,7 +625,7 @@ describe('registered property controls', () => {
message:
'Validation failed: Component name (Card) does not match the registration key (Cart)',
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -677,7 +677,7 @@ describe('registered property controls', () => {
message:
'Validation failed: Module name (/src/card) does not match the module key (/src/cardd)',
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -729,7 +729,7 @@ describe('registered property controls', () => {
message:
'Validation failed: Component name (View) does not match the registration key (Vieww)',
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -781,7 +781,7 @@ describe('registered property controls', () => {
message:
'Validation failed: Module name (utopia-api) does not match the module key (utopia-apii)',
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -832,7 +832,7 @@ describe('registered property controls', () => {
message:
'Validation failed: Component name (Card) does not match the registration key (Cart)',
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down Expand Up @@ -2069,7 +2069,7 @@ describe('Lifecycle management of registering components', () => {
fileName: '/utopia/components.utopia.js',
message: "Validation failed: Component registered for key 'Card' is undefined",
passTime: null,
severity: 'fatal',
severity: 'warning',
source: 'component-descriptor',
startColumn: null,
startLine: null,
Expand Down
11 changes: 8 additions & 3 deletions editor/src/core/property-controls/property-controls-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ import {
jsxElementNameFromString,
jsxTextBlock,
} from '../shared/element-template'
import type { ErrorMessage } from '../shared/error-messages'
import type { ErrorMessage, ErrorMessageSeverity } from '../shared/error-messages'
import { errorMessage } from '../shared/error-messages'
import { dropFileExtension } from '../shared/file-utils'
import type { FancyError } from '../shared/code-exec-utils'
Expand Down Expand Up @@ -418,15 +418,19 @@ async function getComponentDescriptorPromisesFromParseResult(
}
}

function simpleErrorMessage(fileName: string, error: string): ErrorMessage {
function simpleErrorMessage(
fileName: string,
error: string,
severity: ErrorMessageSeverity = 'fatal',
): ErrorMessage {
return errorMessage(
fileName,
null,
null,
null,
null,
'',
'fatal',
severity,
'',
error,
'',
Expand Down Expand Up @@ -490,6 +494,7 @@ function errorsFromComponentRegistration(
`Validation failed: ${messageForComponentRegistrationValidationError(
error.validationError,
)}`,
'warning',
),
]
default:
Expand Down

0 comments on commit 8197242

Please sign in to comment.