Parent contains error record exception

Error Handling Introduction When you start a new Laravel project, error and exception handling is already configured for you. The AppExceptionsHandler class is where all exceptions triggered by your application are logged and then rendered back to the user. We’ll dive deeper into this class throughout this documentation. Configuration The debug option in your […]

Содержание

  1. Error Handling
  2. Introduction
  3. Configuration
  4. The Exception Handler
  5. The Report Method
  6. Global Log Context
  7. The report Helper
  8. Ignoring Exceptions By Type
  9. The Render Method
  10. Reportable & Renderable Exceptions
  11. HTTP Exceptions
  12. Custom HTTP Error Pages
  13. Parent contains error record exception
  14. Numeric constants
  15. Exactness
  16. Characters
  17. Symbols
  18. Case Sensitivity
  19. Printed Representation
  20. Strings
  21. Pairs and Lists
  22. Vectors
  23. Boxes
  24. Parameters
  25. Immutable types
  26. Equivalence
  27. Syntax and Lexical Structure
  28. Comments
  29. Shared Structures
  30. Reader Syntax
  31. Writing
  32. Control Features
  33. Syntactic Extension
  34. Errors and Error Handling
  35. Failure Continuations
  36. Creation
  37. Capture
  38. Interaction with Ordinary Continuations
  39. Error Records
  40. Creating Error Records
  41. Accessors
  42. Raising Errors
  43. Exceptions

Error Handling

Introduction

When you start a new Laravel project, error and exception handling is already configured for you. The AppExceptionsHandler class is where all exceptions triggered by your application are logged and then rendered back to the user. We’ll dive deeper into this class throughout this documentation.

Configuration

The debug option in your config/app.php configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the APP_DEBUG environment variable, which is stored in your .env file.

For local development, you should set the APP_DEBUG environment variable to true . In your production environment, this value should always be false . If the value is set to true in production, you risk exposing sensitive configuration values to your application’s end users.

The Exception Handler

The Report Method

All exceptions are handled by the AppExceptionsHandler class. This class contains two methods: report and render . We’ll examine each of these methods in detail. The report method is used to log exceptions or send them to an external service like Flare, Bugsnag or Sentry. By default, the report method passes the exception to the base class where the exception is logged. However, you are free to log exceptions however you wish.

For example, if you need to report different types of exceptions in different ways, you may use the PHP instanceof comparison operator:

Instead of making a lot of instanceof checks in your report method, consider using reportable exceptions

Global Log Context

If available, Laravel automatically adds the current user’s ID to every exception’s log message as contextual data. You may define your own global contextual data by overriding the context method of your application’s AppExceptionsHandler class. This information will be included in every exception’s log message written by your application:

The report Helper

Sometimes you may need to report an exception but continue handling the current request. The report helper function allows you to quickly report an exception using your exception handler’s report method without rendering an error page:

Ignoring Exceptions By Type

The $dontReport property of the exception handler contains an array of exception types that will not be logged. For example, exceptions resulting from 404 errors, as well as several other types of errors, are not written to your log files. You may add other exception types to this array as needed:

The Render Method

The render method is responsible for converting a given exception into an HTTP response that should be sent back to the browser. By default, the exception is passed to the base class which generates a response for you. However, you are free to check the exception type or return your own custom response:

Reportable & Renderable Exceptions

Instead of type-checking exceptions in the exception handler’s report and render methods, you may define report and render methods directly on your custom exception. When these methods exist, they will be called automatically by the framework:

You may type-hint any required dependencies of the report method and they will automatically be injected into the method by Laravel’s service container.

HTTP Exceptions

Some exceptions describe HTTP error codes from the server. For example, this may be a «page not found» error (404), an «unauthorized error» (401) or even a developer generated 500 error. In order to generate such a response from anywhere in your application, you may use the abort helper:

The abort helper will immediately raise an exception which will be rendered by the exception handler. Optionally, you may provide the response text:

Custom HTTP Error Pages

Laravel makes it easy to display custom error pages for various HTTP status codes. For example, if you wish to customize the error page for 404 HTTP status codes, create a resources/views/errors/404.blade.php . This file will be served on all 404 errors generated by your application. The views within this directory should be named to match the HTTP status code they correspond to. The HttpException instance raised by the abort function will be passed to the view as an $exception variable:

You may publish Laravel’s error page templates using the vendor:publish Artisan command. Once the templates have been published, you may customize them to your liking:

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in most web projects.

Источник

Parent contains error record exception

Floating Point numbers

Depending on the numeric library compiled into SISC , floating point numbers have either 32 or 64 bit IEEE precision, or arbitrary [2] precision. Regardless, SISC ‘s complex numbers have floating point components of the same precision as the reals. Integers have arbitrary precision in all numeric libraries, and rational numbers are built with arbitrary precision components.

Numeric constants

The precision specifying exponents ( S, F, L, and D ) are ignored in SISC , all inexact numbers are kept in the precision of the numeric library. The exponents are read and used to scale the real number as expected. In the case of arbitrary precision floats, specific precision constraints are maintained to prevent a runaway increase of precision. The constraints can be set by minFloatPrecision and maxFloatPrecision configuration parameters on startup. See the section called “Configuration Parameters”.

All four base specifiers ( #x, #o, #d, #b ) are supported for integers and rationals. Only decimal ( #d ), the default, is supported for floating point and complex numbers.

SISC will produce infinite or not-a-number quantities from some operations. Those quantities are represented and can be used in Scheme programs as #!+inf (positive infinity), #!-inf (negative infinity), and #!nan (not-a-number).

Exactness

Exactness and inexactness contagion behaves as expected. Rational’s are made inexact through division. Floats are made exact by conversion to a rational number. SISC attempts as accurate a conversion as possible, by converting the decimal portion of the number to a ratio with a denominator of the form 10^n, where n is the scale of the floating point number. Then the fraction is reduced as usual.

Since complex numbers must have floating point components currently, conversion to an exact merely rounds the components to integers.

Characters

SISC ‘s characters are double-byte wide. This means that they are capable of representing the full range of unicode characters. Unicode characters can be created with number->character ; #nnnnnn , where nnnnnn is an octal number in the range 000000 -> 177777; or #uxxxx , where xxxx is a hexadecimal number in the range 0000 -> ffff. At least two zeros must be specified to distinguish from the ‘0’ character when using an octal character literal. At least one zero must be specified to distinguish a hexadecimal character from the ‘u’ character.

SISC also provides additional named characters, to add to the Scheme standard’s space and newline :

Table 3.1. Named character literals

Character Name Unicode Value (hex)
backspace 0008
newline 000a
nul 0000
page 000c
return 000d
rubout 007f
space 0020
tab 0009

Formally, SISC ‘s lexer modifies the R 5 RS grammar with the following productions for character literals:

Characters are not compared with respect to the locale of the running system. Character comparison is equivalent to numeric comparison of the character value as returned by char->integer .

There are a number of reasons why a full Unicode system is non-trivial, especially within the framework of the R 5 RS string and character functions. Such a discussion is outside the scope of this document. Unicode compliant processing may be made available in the future as a library, however.

Symbols

SISC ‘s symbols are ordinarily case-insensitive. SISC maintains true pointer equality between symbols with like contents, unless the symbol is created uninterned . An uninterned symbol is one which is guaranteed to be pointer distinct from any other symbol in the Scheme system, even another with the same contents. Uninterned symbols can be generated with:

procedure: ( string->uninterned-symbol string ) => symbol

Converts the provided string into an uninterned, pointer distinct symbol.

Uninterned symbols, while always pointer-distinct, may still be equal? to another symbol if its representation matches another.

Case Sensitivity

SISC also allows symbols to be created that are case-sensitive. This can be done one of two ways. The first is by setting the caseSensitive configuration parameter (see the section called “Configuration Parameters”. The second method is via a non-standard symbol syntax. If a symbol is enclosed in pipe (‘|’) characters, the reader will treat that individual symbol as cased. The syntax extends the R 5 RS grammar with the following production:

Example 3.1. Case sensitive Symbol literals

Printed Representation

Symbols may contain characters that are disallowed by R 5 RS using symbol->string . In such a case, the printed representation of that symbol will contain those characters, prefaced with the escape (‘’) character. Likewise, such symbols may be created without symbol->string by escaping non-standard characters.

Symbols which contain characters that could only be present in a case-sensitive environment will be printed in one of two ways, depending on the value of the case-sensitive parameter. If true, the symbols will be printed as is, containing the upper and lower case letters. If false, the symbol will be printed surrounded by pipe characters.

Strings

Strings are built from Unicode characters, and are compared lexicographically in a manner derived from character comparison. In addition to using backslash to escape the double-quote («) character and the backspace character itself, SISC provides several escape codes to ease string literal construction.

Table 3.2. String escape codes

Escape Value
f Inserts the formfeed character (unicode 000c)
n Inserts the newline character (unicode 000a)
r Inserts the rubout character (unicode 007f)
t Inserts the tab character (unicode 0009)
uxxxx Inserts the unicode character described by the hex number ‘xxxx’. All four hex digits must be specified.
\ Inserts the backslash (‘’) character
» Inserts the double quote (‘»‘) character

Pairs and Lists

A function is provided to determine if a given pair is a proper list .

Returns #t if the given argument is a proper-list . That is, if the argument is a pair, whose cdr is either the empty-list or also a proper-list, and which contains no references to itself (is not circular).

Vectors

SISC supports the length prefix method of creating Vector constants. For example, ‘ #5(x) creates a vector constant containing five identical symbols. In addition, the length-prefix form is used when printing vectors, and if elements repeat at the end of a Vector, only the last unique element is printed. This form is referred to as the compact vector representation. The unprefixed form with all elements displayed is called the verbose representation.

Vectors are displayed differently depending on the call used. When called with display , in addition to the ordinary R 5 RS rules regarding the output of values displayed with display , the verbose representation is displayed. Using write , on the other hand produces the compact representation.

Displaying a vector with pretty-print may output either the verbose or compact representation of a vector. The behavior in this regard is controlled by the vectorLengthPrefixing configuration parameter (see the section called “Configuration Parameters”). If set to #t, pretty-print will emit the compact representation. If #f, the verbose representation is produced.

Boxes

SISC supports boxes, a container for a Scheme value. Boxing is often used to implement call-by-reference semantics. Boxes are created and accessed using the following three functions:

Creates a box filled with the given value.

procedure: ( unbox box ) => value

Returns the value contained in the given box.

procedure: ( set-box! box value ) => undefined

Replaces the value contained in the given box with the value provided.

In addition to the box function for creating boxes, SISC provides an external representation for boxes and boxed values. It extends the R 5 RS grammar with the following:

This syntax denotes a boxed value, with as the contained value.

Boxes are a distinct first class type. The box? predicate tests a value to see if is a box.

Returns #t only if the given value is a box.

Boxes, like pairs, are only equal in the sense of eq? and eqv? when a box is compared with itself. A box is equal to another in the sense of equal? if the value contained within the box is equal? to the value contained in the other.

Parameters

A parameter is a named dynamic variable that is accessed through a function. The function, when given no arguments, returns the current value of the parameter. When given an argument, the value of the parameter is set to the provided value.

SISC ‘s parameters are fully compatible with those specified by SRFI-39. Consult the SRFI-39 specification at srfi.schemers.org for documentation on how to construct and use parameters. SRFI-39 does not specify the semantics for parameters in the presence of threads. SISC’s parameters bind into the dynamic environment, which means their semantics are defined based on the semantics of dynamic environments’ interactions with threads, specified in the section called “ Scheme Thread Semantics ”.

Immutable types

SISC follows the R 5 RS recommendation of immutable list, string, and vector constants. Quoted lists and vectors are immutable. Attempting to modify elements in these constants will raise an error. String constants are immutable as well when created with symbol->string .

Equivalence

SISC ‘s storage model maintains true pointer equality between symbols, booleans, the end-of-file object, void, and the empty list. Thus two instances of any of those types is guaranteed to return #t from eq? if they would have produced #t from equal? .

Numbers and characters are not pointer equal ordinarily (unless actually occupying the same storage). SISC will return #t from eqv? if two numbers are both exact, or both inexact, and are numerically equal. Two characters are equivalent from eqv? if they occupy the same code-point in the unicode character set. This is the behavior specified by R 5 RS.

Strings, vectors, lists, and boxes are containers for other Scheme types. As such they are not pointer equal unless they are referenced by two variables that point to the same storage location (i.e. they are actually pointer equal). SISC holds that only equal? will return #t if two objects are the same type and their contents contain equivalent values with respect to equal? .

Syntax and Lexical Structure

In addition to the single line comments of the Scheme standard, SISC supports both s-expression commenting and nested, multiline comments . An s-expression comment is used to comment out an entire s-expression. To do this, the sharp sequence #; is used. It extends the R 5 RS grammar with the following production:

The reader, upon encountering this sharp sequence, will read and discard the next datum. The expression commented out must still be a valid s-expression, however.

Nested, multiline comments are as defined in SRFI-30. Briefly, a multiline comment begins with the sharp sequence #| and ends with the sequence |# . The comment may contain nested comments as well. Unfortunately, this extension cannot be represented in a stateless grammar for the lexical structure.

Shared Structures

Reader Syntax

SISC provides a parse-time syntax for creating data (primarily vectors and lists) that contain references to themselves or data which contains several pointer-equal elements. This can be useful to create streams, graphs, and other self-referencing structures while maintaining readability and avoiding complex construction code.

The reader syntax has two parts, defining a pointer, and later referencing the pointer to create the circular reference.

Below is an additional production in the R 5 RS formal syntax (specifically section 7.1.2, external representations) to support circular structures:

The first form instructs the reader to create a pointer identified by the specified integer, which maps to the datum that follows, and is active during the reading of the datum on the right-hand side of the definition.

If a second definition occurs during the reading of the datum with the same integral identifier, the previous definition is overwritten for the duration of the read. The definitions are not scoped in any way. The pointer identifiers should be kept unique by the programmer to prevent any unintended effects of identifier collisions.

The second form references a previously created pointer definition. It is an error to reference an undefined pointer. The reader will handle a valid reference by placing a pointer at the current read position back to the location of the definition.

At this point some examples might be helpful:

Example 3.2. Circular Structures

Writing

Ordinarily, the display of cyclical data would cause a problem for a Read-Eval-Print-Loop. For this reason, the REPL will attempt to check the structure it is about to print for circularities before printing. If a cycle is found in the structure, the REPL will refuse to print if the printShared configuration parameter, described below, is false . In that case the REPL will issue a warning to the user that the structure contains a cycle. If a circular structure is printed with display , write , etc, and the printShared parameter is set to false , the environment may enter an infinite loop which may or may not cause the Scheme system to exit with an error.

The printShared configuration parameter (see the section called “Configuration Parameters”), if set to true enables SISC to scan data for circularity and data sharing before writing values. If such sharing is found, an alternate printer is invoked which will emit a representation compatible with the circular structure representation described in the previous section.

Alternately, SISC also supports SRFI-38, which describes the functions write-showing-shared and read-with-shared-structure .

Control Features

In addition to the R 5 RS standard control features, two additional forms, when and unless , are supported by SISC .

syntax: ( when condition expression [ expressions ] . ) => value

Evaluates condition , an expression. If true, the expressions that follow are evaluated, in order, the value of the last being returned. If not true, the result is unspecified.

syntax: ( unless condition expression [ expressions ] . ) => value

Evaluates condition , an expression. If false, the expressions that follow are evaluated, in order, the value of the last being returned. If true, the result is unspecified.

Syntactic Extension

SISC provides a hygienic macro system that fully conforms to the R 5 RS standard. The macro system is provided by the portable syntax-case macro expander. In addition to R 5 RS macros, the expander provides a more flexible macro definition tool called syntax-case . A full description of the capabilities of the expander is best found in the Chez Scheme Users Guide , specifically Section 9.2, Syntax-Case .

In addition, SISC supports non-hygienic, legacy macro support in two forms; define-macro and defmacro . These forms, found in older Scheme code written for R 4 RS compliant Scheme systems, should be used only for executing legacy code which relies on it. New code should use the safer and more flexible syntax-case or the standard syntax-rules macros.

syntax: ( define-macro name transformer )

In the first form, define-macro creates a macro transformer bound to name , which when applied will have raw s-expressions bound to one or more parameters ( args ). The (name . args) name and formal parameter form is identical to the short form for procedure definition with define .

The transformer’s body will then, using the s-expressions bound to its arguments, return a new s-expression that is the result of the macro transformation.

The second form binds an arbitrary procedure to the syntactic keyword name , using that procedure to transform occurences of that named syntax during future evaluations.

syntax: ( defmacro name args body . )

defmacro is another macro definition form supported by some Scheme systems. Its semantics are equivalent to:

Errors and Error Handling

Errors can be raised by primitives in libraries and Scheme-level code. SISC provides a sophisticated mechanism for handling these errors when they occur during program execution.

Failure Continuations

During the execution of any program, there is always a continuation that represents the rest of a computation. In addition, one can imagine all the activities that will occur as a result of an error. This sequence of actions is explicitly represented in SISC as a failure continuation .

Two values must be applied to a failure continuation. The first is an error record, a datastructure which describes the error (and may contain information about the name of the function that generated the error, a descriptive message about the error, etc.). The second is the continuation of the expression that raised the error. All errors raised in SISC automatically and implicitly obtain and apply these values to the active failure continuation. Applying the error record and error continuation to the failure continuation will not return to the continuation of the application, unless that continuation was captured and later invoked in a non-local entrance.

Creation

A programmer may wish to augment current failure continuation, choosing a different set of actions to occur for a body of code if it raises an error. To facilitate this, SISC provides the with-failure-continuation procedure.

procedure: ( with-failure-continuation handler thunk ) => value

procedure: ( with/fc handler thunk ) => value

with-failure-continuation takes as arguments a thunk (a zero-argument procedure) to be evaluated. The thunk will be evaluated in the continuation of the with/fc function, and with a failure continuation defined by the provided error handler. If during the evaluation of the thunk an error is raised, the first, two argument procedure is called with values describing the error and its context. If no error occurs, value of the thunk is applied to the continuation of the with/fc expression.

The error handler required as an argument to with-failure-continuation must accept two values. The first is a value containing information about the error that occurred. This is often an association list containing a number of attributes of the error. The second is a procedure encapsulating the continuation that was in place at the site of the error. This continuation is referred to as the error continuation

When an error occurs, the error handler may choose one of three courses in dealing with the error. First, the handler may choose to return an alternate value to be applied to the continuation of the with/fc expression. Second, the handler may restart the computation from the error site by invoking the error continuation with a value that should be returned in place of the expression that caused the error. Finally, the handler may choose to propagate the error (or a new error) to the failure continuation of the with/fc expression. This can be done with the throw function described in the section called “Raising Errors”.

Capture

The currently active failure continuation may be obtained explicitly using the call-with-failure-continuation procedure. This continuation may be applied to appropriate values at any time in the future.

procedure: ( call-with-failure-continuation procedure ) => value

procedure: ( call/fc procedure ) => value

Calls the given one-argument procedure with the currently active failure continuation.

Interaction with Ordinary Continuations

Failure continuations exist as an attribute of the ordinary continuations of Scheme expressions. Because of this, the invocation of a continuation may cause a different failure continuation to become active in the region of the captured continuation. Specifically, the failure continuation in place at the call/cc expression will be reinstated when that continuation is later invoked.

Similarly, invoking a continuation that escapes a region of code will cause any created failure continuations to be abandoned, unless the region is itself captured in a continuation and later invoked.

Error Records

An error record is the value usually propagated with an error in SISC . It is a datastructure containing such information as the location of the error, a descriptive message about the error, and possibly other error metadata.

Creating Error Records

Error records can be created in advance of actually raising an error with the make-error function. The function allows the programmer to create error records that contain a location and a message or value. No field of an error record is required.

procedure: ( make-error [ location ] [ message ] [ arguments ] . ) => error-record

Constructs an error record. If present, a symbol, and not #f , the first argument is the location of the error, which may be a symbol equivalent to a function identifier. If present, the message is a format-string processed with the optional arguments that follow as by format in SRFI-28. The remaining arguments must only be present if the format-string is present as the message.

procedure: ( make-error [ location ] error-value ) => error-record

Constructs an error record. If present, a symbol, and not #f , the first argument is the location of the error. The second argument is an arbitrary Scheme value that will be the error value. This value will be accessible with the error-message function.

None of the fields of an error-record are required. One may create an error record with no information, an error record with only a location, or an error record with only a message or value. Below are some examples (for an explanation of the throw procedure see the section called “Raising Errors”).

In addition, an error record may be created that adds additional information to an error record that was already created. This is useful when an error was caught in an error handler, and one wishes to raise an error from the handler that contains additional information about the local location or error message as well as the error that was caught.

procedure: ( make-nested-error local-error parent-error parent-error-continuation ) => error-record

procedure: ( make-nested-error local-error exception ) => error-record

The first version creates an error record which has parent-error (and its associated parent-error-continuation ) as the root cause of an error-record passed as local-error .

The second version creates an error record which has exception (see the section called “Exceptions”) as the root cause of an error passed as local-error .

An example of the creating, throwing, and display of a nested error follows.

Accessors

An error record contains several useful pieces of information. The following functions allow the programmer to access that information.

procedure: ( error-location error-record ) => symbol

Obtains the location of the error, a symbol which may be a function identifier. If there is no location specified, #f is returned.

procedure: ( error-message error-record ) => value

Obtains the message of the error, which may be a string which is a descriptive message of the error, or an arbitrary value (as created by the second form of make-error ). If there is no message specified, #f is returned.

procedure: ( error-parent-error error-record ) => error-record

Obtains the parent error of the error. This is the value of the second argument to the make-nested-error function. If there is no parent specified, #f is returned.

procedure: ( error-parent-continuation error-record ) => error-continuation

Obtains the parent error continuation of the error. This is the value of the third argument to the make-nested-error function. If there is no parent specified, #f is returned.

Raising Errors

The fundamental mechanism for raising an error in application code is provided by the throw procedure.

procedure: ( throw error-record [ error-continuation ]) => does not return

procedure: ( throw exception ) => does not return

The first verison applies the given error record to the current failure continuation. If provided, the error continuation is designated by the optional parameter. If not, the continuation of the throw expression is used.

The second form applies the current failure continuation to the error record and error continuation extracted from the supplied exception (see the section called “Exceptions”).

If invoked from an error-handler with the values of the handler’s formal parameters, throw has the effect of propagating the error in a manner that is equivalent to the absence of the modified failure-continuation.

throw could be defined in terms of call-with-failure-continuation as:

For convenience and compatibility with SRFI-23, the function error is provided. Its syntax is identical to make-error , but it immediately applies the resulting error record to the current failure continuation with the current continuation as the error continuation.

procedure: ( error [ location ] [ message ] [ arguments ] . ) => does not return

Raises an error record whose location, if provided, is location , a symbol; and whose error message, if present, is message . If provided, the error message is a format-string that is processed, with the optional argument s, as with the format function in SRFI 28.

procedure: ( error [ location ] error-value ) => does not return

Raises an error record whose location, if present, is the symbol location , and and whose error-value is any arbitrary Scheme value.

error can be implemented in terms of throw and make-error :

Exceptions

Exceptions in SISC are a simple wrapper around an error record and an associated error continuation.

Exceptions are created with

procedure: ( make-exception error-record error-continuation ) => exception

Constructs an exception from an error-record and an error-continuation , e.g. as obtained from the arguments of a handler procedure passed to with-fc .

Accessors and a type-test are provided by the following procedures:

procedure: ( exception-error exception ) => error-record

Returns the exception ‘s error record.

procedure: ( exception-continuation exception ) => error-continuation

Returns the exception ‘s error continuation.

procedure: ( exception? value ) => #t/#f

Returns #t if value is an exception object, #f otherwise.

Источник

# frozen_string_literal: true module ActiveRecord # = Active Record Errors # # Generic Active Record exception class. class ActiveRecordError < StandardError end # DEPRECATED: Previously raised when trying to use a feature in Active Record which # requires Active Job but the gem is not present. Now raises a NameError. include ActiveSupport::Deprecation::DeprecatedConstantAccessor DeprecatedActiveJobRequiredError = Class.new(ActiveRecordError) # :nodoc: deprecate_constant «ActiveJobRequiredError», «ActiveRecord::DeprecatedActiveJobRequiredError», message: «ActiveRecord::ActiveJobRequiredError has been deprecated. If Active Job is not present, a NameError will be raised instead.», deprecator: ActiveRecord.deprecator # Raised when the single-table inheritance mechanism fails to locate the subclass # (for example due to improper usage of column that # {ActiveRecord::Base.inheritance_column}[rdoc-ref:ModelSchema::ClassMethods#inheritance_column] # points to). class SubclassNotFound < ActiveRecordError end # Raised when an object assigned to an association has an incorrect type. # # class Ticket < ActiveRecord::Base # has_many :patches # end # # class Patch < ActiveRecord::Base # belongs_to :ticket # end # # # Comments are not patches, this assignment raises AssociationTypeMismatch. # @ticket.patches << Comment.new(content: «Please attach tests to your patch.») class AssociationTypeMismatch < ActiveRecordError end # Raised when unserialized object’s type mismatches one specified for serializable field. class SerializationTypeMismatch < ActiveRecordError end # Raised when adapter not specified on connection (or configuration file # +config/database.yml+ misses adapter field). class AdapterNotSpecified < ActiveRecordError end # Raised when a model makes a query but it has not specified an associated table. class TableNotSpecified < ActiveRecordError end # Raised when Active Record cannot find database adapter specified in # +config/database.yml+ or programmatically. class AdapterNotFound < ActiveRecordError end # Raised when connection to the database could not been established (for example when # {ActiveRecord::Base.connection=}[rdoc-ref:ConnectionHandling#connection] # is given a +nil+ object). class ConnectionNotEstablished < ActiveRecordError end # Raised when a connection could not be obtained within the connection # acquisition timeout period: because max connections in pool # are in use. class ConnectionTimeoutError < ConnectionNotEstablished end # Raised when connection to the database could not been established because it was not # able to connect to the host or when the authorization failed. class DatabaseConnectionError < ConnectionNotEstablished def initialize(message = nil) super(message || «Database connection error») end class << self def hostname_error(hostname) DatabaseConnectionError.new(<<~MSG) There is an issue connecting with your hostname: #{hostname}.n Please check your database configuration and ensure there is a valid connection to your database. MSG end def username_error(username) DatabaseConnectionError.new(<<~MSG) There is an issue connecting to your database with your username/password, username: #{username}.n Please check your database configuration to ensure the username/password are valid. MSG end end end # Raised when a pool was unable to get ahold of all its connections # to perform a «group» action such as # {ActiveRecord::Base.connection_pool.disconnect!}[rdoc-ref:ConnectionAdapters::ConnectionPool#disconnect!] # or {ActiveRecord::Base.connection_handler.clear_reloadable_connections!}[rdoc-ref:ConnectionAdapters::ConnectionHandler#clear_reloadable_connections!]. class ExclusiveConnectionTimeoutError < ConnectionTimeoutError end # Raised when a write to the database is attempted on a read only connection. class ReadOnlyError < ActiveRecordError end # Raised when Active Record cannot find a record by given id or set of ids. class RecordNotFound < ActiveRecordError attr_reader :model, :primary_key, :id def initialize(message = nil, model = nil, primary_key = nil, id = nil) @primary_key = primary_key @model = model @id = id super(message) end end # Raised by {ActiveRecord::Base#save!}[rdoc-ref:Persistence#save!] and # {ActiveRecord::Base.create!}[rdoc-ref:Persistence::ClassMethods#create!] # methods when a record is invalid and cannot be saved. class RecordNotSaved < ActiveRecordError attr_reader :record def initialize(message = nil, record = nil) @record = record super(message) end end # Raised by {ActiveRecord::Base#destroy!}[rdoc-ref:Persistence#destroy!] # when a call to {#destroy}[rdoc-ref:Persistence#destroy] # would return false. # # begin # complex_operation_that_internally_calls_destroy! # rescue ActiveRecord::RecordNotDestroyed => invalid # puts invalid.record.errors # end # class RecordNotDestroyed < ActiveRecordError attr_reader :record def initialize(message = nil, record = nil) @record = record super(message) end end # Raised when Active Record finds multiple records but only expected one. class SoleRecordExceeded < ActiveRecordError attr_reader :record def initialize(record = nil) @record = record super «Wanted only one #{record&.name || «record»}« end end # Superclass for all database execution errors. # # Wraps the underlying database error as +cause+. class StatementInvalid < ActiveRecordError def initialize(message = nil, sql: nil, binds: nil) super(message || $!&.message) @sql = sql @binds = binds end attr_reader :sql, :binds def set_query(sql, binds) unless @sql @sql = sql @binds = binds end self end end # Defunct wrapper class kept for compatibility. # StatementInvalid wraps the original exception now. class WrappedDatabaseException < StatementInvalid end # Raised when a record cannot be inserted or updated because it would violate a uniqueness constraint. class RecordNotUnique < WrappedDatabaseException end # Raised when a record cannot be inserted or updated because it references a non-existent record, # or when a record cannot be deleted because a parent record references it. class InvalidForeignKey < WrappedDatabaseException end # Raised when a foreign key constraint cannot be added because the column type does not match the referenced column type. class MismatchedForeignKey < StatementInvalid def initialize( message: nil, sql: nil, binds: nil, table: nil, foreign_key: nil, target_table: nil, primary_key: nil, primary_key_column: nil, query_parser: nil ) @original_message = message @query_parser = query_parser if table type = primary_key_column.bigint? ? :bigint : primary_key_column.type msg = <<~EOM.squish Column `#{foreign_key}` on table `#{table}` does not match column `#{primary_key}` on `#{target_table}`, which has type `#{primary_key_column.sql_type}`. To resolve this issue, change the type of the `#{foreign_key}` column on `#{table}` to be :#{type}. (For example `t.#{type} :#{foreign_key}`). EOM else msg = <<~EOM.squish There is a mismatch between the foreign key and primary key column types. Verify that the foreign key column type and the primary key of the associated table match types. EOM end if message msg << «nOriginal message: #{message}« end super(msg, sql: sql, binds: binds) end def set_query(sql, binds) if @query_parser && !@sql self.class.new( message: @original_message, sql: sql, binds: binds, **@query_parser.call(sql) ).tap do |exception| exception.set_backtrace backtrace end else super end end end # Raised when a record cannot be inserted or updated because it would violate a not null constraint. class NotNullViolation < StatementInvalid end # Raised when a record cannot be inserted or updated because a value too long for a column type. class ValueTooLong < StatementInvalid end # Raised when values that executed are out of range. class RangeError < StatementInvalid end # Raised when a statement produces an SQL warning. class SQLWarning < ActiveRecordError attr_reader :code, :level attr_accessor :sql def initialize(message = nil, code = nil, level = nil, sql = nil) super(message) @code = code @level = level @sql = sql end end # Raised when the number of placeholders in an SQL fragment passed to # {ActiveRecord::Base.where}[rdoc-ref:QueryMethods#where] # does not match the number of values supplied. # # For example, when there are two placeholders with only one value supplied: # # Location.where(«lat = ? AND lng = ?», 53.7362) class PreparedStatementInvalid < ActiveRecordError end # Raised when a given database does not exist. class NoDatabaseError < StatementInvalid include ActiveSupport::ActionableError action «Create database» do ActiveRecord::Tasks::DatabaseTasks.create_current end def initialize(message = nil) super(message || «Database not found») end class << self def db_error(db_name) NoDatabaseError.new(<<~MSG) We could not find your database: #{db_name}. Available database configurations can be found in config/database.yml file. To resolve this error: — Did you create the database for this app, or delete it? You may need to create your database. — Has the database name changed? Check your database.yml config has the correct database name. To create your database, run:nn bin/rails db:create MSG end end end # Raised when creating a database if it exists. class DatabaseAlreadyExists < StatementInvalid end # Raised when PostgreSQL returns ‘cached plan must not change result type’ and # we cannot retry gracefully (e.g. inside a transaction) class PreparedStatementCacheExpired < StatementInvalid end # Raised on attempt to save stale record. Record is stale when it’s being saved in another query after # instantiation, for example, when two users edit the same wiki page and one starts editing and saves # the page before the other. # # Read more about optimistic locking in ActiveRecord::Locking module # documentation. class StaleObjectError < ActiveRecordError attr_reader :record, :attempted_action def initialize(record = nil, attempted_action = nil) if record && attempted_action @record = record @attempted_action = attempted_action super(«Attempted to #{attempted_action} a stale object: #{record.class.name}) else super(«Stale object error.») end end end # Raised when association is being configured improperly or user tries to use # offset and limit together with # {ActiveRecord::Base.has_many}[rdoc-ref:Associations::ClassMethods#has_many] or # {ActiveRecord::Base.has_and_belongs_to_many}[rdoc-ref:Associations::ClassMethods#has_and_belongs_to_many] # associations. class ConfigurationError < ActiveRecordError end # Raised on attempt to update record that is instantiated as read only. class ReadOnlyRecord < ActiveRecordError end # Raised on attempt to lazily load records that are marked as strict loading. class StrictLoadingViolationError < ActiveRecordError end # {ActiveRecord::Base.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] # uses this exception to distinguish a deliberate rollback from other exceptional situations. # Normally, raising an exception will cause the # {.transaction}[rdoc-ref:Transactions::ClassMethods#transaction] method to rollback # the database transaction *and* pass on the exception. But if you raise an # ActiveRecord::Rollback exception, then the database transaction will be rolled back, # without passing on the exception. # # For example, you could do this in your controller to rollback a transaction: # # class BooksController < ActionController::Base # def create # Book.transaction do # book = Book.new(params[:book]) # book.save! # if today_is_friday? # # The system must fail on Friday so that our support department # # won’t be out of job. We silently rollback this transaction # # without telling the user. # raise ActiveRecord::Rollback # end # end # # ActiveRecord::Rollback is the only exception that won’t be passed on # # by ActiveRecord::Base.transaction, so this line will still be reached # # even on Friday. # redirect_to root_url # end # end class Rollback < ActiveRecordError end # Raised when attribute has a name reserved by Active Record (when attribute # has name of one of Active Record instance methods). class DangerousAttributeError < ActiveRecordError end # Raised when unknown attributes are supplied via mass assignment. UnknownAttributeError = ActiveModel::UnknownAttributeError # Raised when an error occurred while doing a mass assignment to an attribute through the # {ActiveRecord::Base#attributes=}[rdoc-ref:AttributeAssignment#attributes=] method. # The exception has an +attribute+ property that is the name of the offending attribute. class AttributeAssignmentError < ActiveRecordError attr_reader :exception, :attribute def initialize(message = nil, exception = nil, attribute = nil) super(message) @exception = exception @attribute = attribute end end # Raised when there are multiple errors while doing a mass assignment through the # {ActiveRecord::Base#attributes=}[rdoc-ref:AttributeAssignment#attributes=] # method. The exception has an +errors+ property that contains an array of AttributeAssignmentError # objects, each corresponding to the error while assigning to an attribute. class MultiparameterAssignmentErrors < ActiveRecordError attr_reader :errors def initialize(errors = nil) @errors = errors end end # Raised when a primary key is needed, but not specified in the schema or model. class UnknownPrimaryKey < ActiveRecordError attr_reader :model def initialize(model = nil, description = nil) if model message = «Unknown primary key for table #{model.table_name} in model #{model} message += «n#{description}« if description @model = model super(message) else super(«Unknown primary key.») end end end # Raised when a relation cannot be mutated because it’s already loaded. # # class Task < ActiveRecord::Base # end # # relation = Task.all # relation.loaded? # => true # # # Methods which try to mutate a loaded relation fail. # relation.where!(title: ‘TODO’) # => ActiveRecord::ImmutableRelation # relation.limit!(5) # => ActiveRecord::ImmutableRelation class ImmutableRelation < ActiveRecordError end # TransactionIsolationError will be raised under the following conditions: # # * The adapter does not support setting the isolation level # * You are joining an existing open transaction # * You are creating a nested (savepoint) transaction # # The mysql2 and postgresql adapters support setting the transaction isolation level. class TransactionIsolationError < ActiveRecordError end # TransactionRollbackError will be raised when a transaction is rolled # back by the database due to a serialization failure or a deadlock. # # See the following: # # * https://www.postgresql.org/docs/current/static/transaction-iso.html # * https://dev.mysql.com/doc/mysql-errors/en/server-error-reference.html#error_er_lock_deadlock class TransactionRollbackError < StatementInvalid end # AsynchronousQueryInsideTransactionError will be raised when attempting # to perform an asynchronous query from inside a transaction class AsynchronousQueryInsideTransactionError < ActiveRecordError end # SerializationFailure will be raised when a transaction is rolled # back by the database due to a serialization failure. class SerializationFailure < TransactionRollbackError end # Deadlocked will be raised when a transaction is rolled # back by the database when a deadlock is encountered. class Deadlocked < TransactionRollbackError end # IrreversibleOrderError is raised when a relation’s order is too complex for # +reverse_order+ to automatically reverse. class IrreversibleOrderError < ActiveRecordError end # Superclass for errors that have been aborted (either by client or server). class QueryAborted < StatementInvalid end # LockWaitTimeout will be raised when lock wait timeout exceeded. class LockWaitTimeout < StatementInvalid end # StatementTimeout will be raised when statement timeout exceeded. class StatementTimeout < QueryAborted end # QueryCanceled will be raised when canceling statement due to user request. class QueryCanceled < QueryAborted end # AdapterTimeout will be raised when database clients times out while waiting from the server. class AdapterTimeout < QueryAborted end # ConnectionFailed will be raised when the network connection to the # database fails while sending a query or waiting for its result. class ConnectionFailed < QueryAborted end # UnknownAttributeReference is raised when an unknown and potentially unsafe # value is passed to a query method. For example, passing a non column name # value to a relation’s #order method might cause this exception. # # When working around this exception, caution should be taken to avoid SQL # injection vulnerabilities when passing user-provided values to query # methods. Known-safe values can be passed to query methods by wrapping them # in Arel.sql. # # For example, the following code would raise this exception: # # Post.order(«REPLACE(title, ‘misc’, ‘zzzz’) asc»).pluck(:id) # # The desired result can be accomplished by wrapping the known-safe string # in Arel.sql: # # Post.order(Arel.sql(«REPLACE(title, ‘misc’, ‘zzzz’) asc»)).pluck(:id) # # Again, such a workaround should *not* be used when passing user-provided # values, such as request parameters or model attributes to query methods. class UnknownAttributeReference < ActiveRecordError end end

Hi guys, I have the same problem.

I spent some time to determine the error it was caused for the config.yml.

My child theme worked fine but today crashing with Error 500 in the Theme section of the backoffice..

I maked test but don’t understand why with one config.yml work fine but not with other.

With this don’t working and crash with Error 500:

parent: warehouse
name: warehousechild
display_name: Warehouse child theme
version: 1.0
author:
  name: «IQIT»
assets:
  use_parent_assets: true
  css:
    all:
      — id: font-awesome
        path: assets/css/font-awesome/css/font-awesome.css
        media: all
        priority: 200

modules:
   to_enable:
     — revsliderprestashop
     — iqitadditionaltabs
     — iqithtmlandbanners
     — iqitcompare
     — iqitcontactpage
     — iqitcookielaw
     — iqitcrossselling
     — iqitcountdown
     — iqitelementor
     — iqitemailsubscriptionconf
     — iqitaddthisplugin
     — iqitfreedeliverycount
     — iqitlinksmanager
     — iqitmegamenu
     — iqitpopup
     — iqitproductsnav
     — iqitproducttags
     — iqitreviews
     — iqitsearch
     — iqitsizecharts
     — iqitthemeeditor
     — iqitwishlist
     — iqitextendedproduct
     — ps_emailsubscription
     — ph_simpleblog
     — ph_blog_column_custom
     — ph_relatedposts
     — iqitdashboardnews
     — iqitsociallogin
   to_disable:
     — ps_linklist
     — ps_mainmenu
     — ps_categorytree
     — ps_featuredproducts
     — ps_searchbar
     — ps_imageslider
     — ps_customtext
     — blockreassurance
     — ps_banner
     — ps_contactinfo
     — ps_socialfollow

     
  hooks:
    modules_to_hook:
      displayNav1:
      displayNav2:
        — ps_languageselector
        — ps_currencyselector
        — iqitwishlist
        — iqitcompare
      displayTopColumn:
        — revsliderprestashop
      displayHome:
        — revsliderprestashop
        — iqitelementor
      displayFooter:
        — iqitlinksmanager
        — iqitcontactpage
      displayLeftColumn:
        — ps_categorytree
        — ps_facetedsearch
      displayProductAdditionalInfo:
        — ps_sharebuttons
        — iqitproducttags
      displayAfterProductAddCartBtn:
        — iqitwishlist
        — iqitcompare
      displayCustomerAccount:
        — iqitwishlist
      displayProductListFunctionalButtons:
        — iqitwishlist
        — iqitcompare
      displayBeforeBodyClosingTag:
        — iqitwishlist
        — iqitcompare
        — iqitpopup
        — iqitcookielaw
      displayRightColumnProduct:
        — iqithtmlandbanners
      displayReassurance:
        — iqitaddthisplugin
      displayCustomerLoginFormAfter:
        — iqitsociallogin
      displayRegistrationBeforeForm:
        — iqitsociallogin
      displayFooterBefore:
      displayCheckoutLoginFormAfter:
        — iqitsociallogin
      displayBackOfficeHeader:
        — iqitelementor
      displayCMSDisputeInformation:
        — iqitelementor
      displayBlogElementor:
        — iqitelementor
      displayProductElementor:
        — iqitelementor
      displayCategoryElementor:
        — iqitelementor
  image_types:
    cart_default:
      width: 162
      height: 162
      scope: [products]
    small_default:
      width: 100
      height: 100
      scope: [products, categories, manufacturers, suppliers]
    medium_default:
      width: 540
      height: 540
      scope: [products, categories, manufacturers, suppliers]
    home_default:
      width: 640
      height: 640
      scope: [products]
    large_default:
      width: 780
      height: 780
      scope: [products, manufacturers, suppliers]
    category_default:
      width: 1003
      height: 200
      scope: [categories]
    stores_default:
      width: 115
      height: 115
      scope: [stores]
    thickbox_default:
      width: 1920
      height: 1920
      scope: [products]


theme_settings:
  default_layout: layout-full-width
  layouts:
    category: layout-full-width
    best-sales: layout-full-width
    new-products: layout-full-width
    prices-drop: layout-full-width

dependencies:
  modules:
    — iqitadditionaltabs
    — iqitaddthisplugin
    — iqitcompare
    — iqitcontactpage
    — iqitcookielaw
    — iqitcountdown
    — iqitcrossselling
    — iqitelementor
    — iqitemailsubscriptionconf
    — iqitextendedproduct
    — iqitfreedeliverycount
    — iqitlinksmanager
    — iqitmegamenu
    — iqitpopup
    — iqitproductsnav
    — iqitproducttags
    — iqitreviews
    — iqitsearch
    — iqitsizecharts
    — iqitsociallogin
    — iqithtmlandbanners
    — iqitthemeeditor
    — iqitwishlist
    — revsliderprestashop
    — ph_simpleblog
    — ph_blog_column_custom
    — ph_relatedposts
    — iqitdashboardnews

But with this works fine:

parent: warehouse
name: warehousechild
display_name: Warehouse child theme
version: 1.0
author:
  name: «IQIT»
assets:
  use_parent_assets: true
  css:
    all:
      — id: font-awesome
        path: assets/css/font-awesome/css/font-awesome.css
        media: all
        priority: 200

My idea it’s add the Image config in the config.yml but those code part crashing with error 500.

Somebody have the answer to this?
The most extrange it’s I’m copy those code for the config.yml of the father theme (modules, images, layout, etc)
Very thanks

Понравилась статья? Поделить с друзьями:
  • Pantum m7100dn ошибка принтера 05
  • Pantum bm5100adn ошибка принтера 02
  • Panotour pro fatal error xml loading failed
  • P3348 003 ошибка туарег
  • P307a ошибка audi