Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated name and references #11098

Merged
merged 6 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormStepsButton } from '@18f/identity-form-steps';
import { Cancel } from '@18f/identity-verify-flow';
import { useI18n, HtmlTextWithStrongNoWrap } from '@18f/identity-react-i18n';
import type { FormStepComponentProps } from '@18f/identity-form-steps';
import UnknownError from './unknown-error';
import GeneralError from './general-error';
import TipList from './tip-list';
import { SelfieCaptureContext } from '../context';
import {
Expand Down Expand Up @@ -53,7 +53,7 @@ function DocumentCaptureReviewIssues({
{isSelfieCaptureEnabled && (
<DocumentCaptureSubheaderOne isSelfieCaptureEnabled={isSelfieCaptureEnabled} />
)}
<UnknownError
<GeneralError
unknownFieldErrors={unknownFieldErrors}
isFailedDocType={isFailedDocType}
isFailedSelfie={isFailedSelfie}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FormStepError } from '@18f/identity-form-steps';
import type { I18n } from '@18f/identity-i18n';
import Warning from './warning';
import DocumentCaptureTroubleshootingOptions from './document-capture-troubleshooting-options';
import UnknownError from './unknown-error';
import GeneralError from './general-error';
import { InPersonContext } from '../context';
import AnalyticsContext from '../context/analytics';
import SelfieCaptureContext from '../context/selfie-capture';
Expand Down Expand Up @@ -124,7 +124,7 @@ function DocumentCaptureWarning({
>
<div ref={subheadingRef}>{!!subheading && subheading}</div>
<div ref={errorMessageDisplayedRef}>
<UnknownError
<GeneralError
unknownFieldErrors={unknownFieldErrors}
isFailedDocType={isFailedDocType}
isFailedSelfie={isFailedSelfie}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Link } from '@18f/identity-components';
import formatHTML from '@18f/identity-react-i18n/format-html';
import MarketingSiteContext from '../context/marketing-site';

interface UnknownErrorProps extends ComponentProps<'p'> {
interface GeneralErrorProps extends ComponentProps<'p'> {
unknownFieldErrors: FormStepError<{ front: string; back: string }>[];
isFailedDocType: boolean;
isFailedSelfie: boolean;
Expand Down Expand Up @@ -40,15 +40,15 @@ function getError({ unknownFieldErrors }: GetErrorArguments) {
return err;
}

function UnknownError({
function GeneralError({
unknownFieldErrors = [],
isFailedDocType = false,
isFailedSelfie = false,
isFailedSelfieLivenessOrQuality = false,
altFailedDocTypeMsg = null,
altIsFailedSelfieDontIncludeAttempts = false,
hasDismissed,
}: UnknownErrorProps) {
}: GeneralErrorProps) {
const { t } = useI18n();
const { getHelpCenterURL } = useContext(MarketingSiteContext);
const helpCenterLink = getHelpCenterURL({
Expand Down Expand Up @@ -107,4 +107,4 @@ function UnknownError({
return <p />;
}

export default UnknownError;
export default GeneralError;
2 changes: 1 addition & 1 deletion app/javascript/packages/webauthn/is-expected-error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('isExpectedWebauthnError', () => {
});

it('returns false for instance of DOMException of an unexpected name', () => {
const error = new DOMException('', 'UnknownError');
const error = new DOMException('', 'GeneralError');
AShukla-GSA marked this conversation as resolved.
Show resolved Hide resolved
const result = isExpectedWebauthnError(error);

expect(result).to.be.false();
Expand Down
4 changes: 2 additions & 2 deletions app/services/doc_auth/error_generator.rb
AShukla-GSA marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_selfie_error(liveness_enabled, response_info)
end
end

class UnknownErrorHandler < ErrorHandler
class GeneralErrorHandler < ErrorHandler
def initialize(config:)
@config = config
end
Expand Down Expand Up @@ -333,7 +333,7 @@ def generate_doc_auth_errors(response_info)
end

# catch all route, technically should not happen
unknown_error_handler = UnknownErrorHandler.new(config: config)
unknown_error_handler = GeneralErrorHandler.new(config: config)
unknown_error_handler.handle(response_info).to_h
end

Expand Down
2 changes: 1 addition & 1 deletion scripts/enforce-typescript-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const LEGACY_FILE_EXCEPTIONS = [
'spec/javascript/packages/document-capture/components/submission-spec.jsx',
'spec/javascript/packages/document-capture/components/suspense-error-boundary-spec.jsx',
'spec/javascript/packages/document-capture/components/tip-list-spec.jsx',
'spec/javascript/packages/document-capture/components/unknown-error-spec.jsx',
'spec/javascript/packages/document-capture/components/general-error-spec.jsx',
'spec/javascript/packages/document-capture/components/warning-spec.jsx',
'spec/javascript/packages/document-capture/context/acuant-spec.jsx',
'spec/javascript/packages/document-capture/context/device-spec.jsx',
Expand Down
AShukla-GSA marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import UnknownError from '@18f/identity-document-capture/components/unknown-error';
import GeneralError from '@18f/identity-document-capture/components/general-error';
import { toFormEntryError } from '@18f/identity-document-capture/services/upload';
import { within } from '@testing-library/dom';
import { render } from '../../../support/document-capture';

describe('UnknownError', () => {
describe('GeneralError', () => {
context('there is no doc type failure', () => {
it('render an empty paragraph when no errors', () => {
const { container } = render(
<UnknownError unknownFieldErrors={[]} isFailedDocType={false} />,
<GeneralError unknownFieldErrors={[]} isFailedDocType={false} />,
);
expect(container.querySelector('p')).to.be.ok();
});

context('hasDismissed is true', () => {
it('renders error message with errors and a help center link', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -36,7 +36,7 @@ describe('UnknownError', () => {
context('hasDismissed is false', () => {
it('renders error message with errors but no link', () => {
const { container, queryByRole } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -62,7 +62,7 @@ describe('UnknownError', () => {
context('there is a doc type failure', () => {
it('renders error message with errors and is a doc type failure', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -78,7 +78,7 @@ describe('UnknownError', () => {

it('renders alternative error message with errors and is a doc type failure', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -97,7 +97,7 @@ describe('UnknownError', () => {
context('there is a selfie quality/liveness failure', () => {
it('renders error message with errors', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -112,7 +112,7 @@ describe('UnknownError', () => {

it('renders alternative error message without retry information', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -130,7 +130,7 @@ describe('UnknownError', () => {
context('there is a selfie facematch failure', () => {
it('renders error message with errors', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand All @@ -145,7 +145,7 @@ describe('UnknownError', () => {

it('renders alternative error message without retry information', () => {
const { container } = render(
<UnknownError
<GeneralError
unknownFieldErrors={[
{
field: 'general',
Expand Down