{"record":{"id":"b757f95e6ccfb5c2","repo":"Shopify/liquid","slug":"template-default-exception-renderer","errorCode":null,"errorMessage":"Template.default_exception_renderer=","messagePattern":"Template\\.default_exception_renderer=","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/liquid/template.rb","lineNumber":39,"sourceCode":"    attr_reader :profiler\n\n    class << self\n      # Sets how strict the parser should be.\n      # :lax acts like liquid 2.5 and silently ignores malformed tags in most cases.\n      # :warn is the default and will give deprecation warnings when invalid syntax is used.\n      # :strict enforces correct syntax for most tags\n      # :strict2 enforces correct syntax for all tags\n      def error_mode=(mode)\n        Deprecations.warn(\"Template.error_mode=\", \"Environment#error_mode=\")\n        Environment.default.error_mode = mode\n      end\n\n      def error_mode\n        Environment.default.error_mode\n      end\n\n      def default_exception_renderer=(renderer)\n        Deprecations.warn(\"Template.default_exception_renderer=\", \"Environment#exception_renderer=\")\n        Environment.default.exception_renderer = renderer\n      end\n\n      def default_exception_renderer\n        Environment.default.exception_renderer\n      end\n\n      def file_system=(file_system)\n        Deprecations.warn(\"Template.file_system=\", \"Environment#file_system=\")\n        Environment.default.file_system = file_system\n      end\n\n      def file_system\n        Environment.default.file_system\n      end\n\n      def tags\n        Environment.default.tags","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/template.rb#L21-L57","documentation":"Setting Liquid::Template.default_exception_renderer= is deprecated; global template defaults moved to Liquid::Environment, and this shim forwards to Environment#exception_renderer= while emitting a deprecation warning.","triggerScenarios":"Calling Liquid::Template.default_exception_renderer = ->(e){ ... } in an initializer or test setup.","commonSituations":"Apps upgrading from Liquid 4-era global configuration; centralizers that render templates with custom error handling per environment.","solutions":["Set Liquid::Environment.default.exception_renderer = renderer","Prefer building a dedicated Environment with its own exception_renderer and pass it to Template.parse"],"exampleFix":"// before\nLiquid::Template.default_exception_renderer = ->(e) { e.message }\n// after\nLiquid::Environment.default.exception_renderer = ->(e) { e.message }","handlingStrategy":"validation","validationCode":"env = Liquid::Environment.default\nenv.exception_renderer = renderer # configure via Environment, not Template","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize Liquid configuration in one initializer that only uses Environment","Fail tests when any Liquid deprecation warning appears","Avoid assigning to Template class-level setters in gems/engines"],"tags":["ruby","liquid","deprecation"],"backgroundTag":"deprecated-api-usage","analyzedSha":"807d45a6b3d4568e64e86b375e3702df2c7c860c","analyzedAt":"2026-09-08T11:31:38.917Z","contentChangedAt":"2026-09-08T11:31:38.917Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}