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

Fix error in bus.worldTime.currentTime #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KLarpen
Copy link
Contributor

@KLarpen KLarpen commented Dec 15, 2023

Way to reproduce an error

  1. Enable execution of domain.time.start hook by switching config.examples.bus value to true
  2. node server.js
  3. There is a log message in a console that means something works not properly but without explicit error
20:40:18  W1   log     undefined - undefined

originated from

console.log(`${time.timezone} - ${time.datetime}`);

4. Check the whole time value by adding console.debug(time); line and restarting the server.
5. time contains an Error: Invalid result type: Field "dst_from" not of expected type: string; Field "dst_until" not of expected type: string that is returned error but not thrown exception. That's why it cannot be catched and actually happens during processing of successful remote service answer.

Resolving

Direct request to the remote service reveals that dst_from and day until might has null as a value.

{
  abbreviation: 'CET',
  client_ip: '176.36.183.159',
  datetime: '2023-12-15T21:44:59.632338+01:00',
  day_of_week: 5,
  day_of_year: 349,
  dst: false,
  dst_from: null,
  dst_offset: 0,
  dst_until: null,
  raw_offset: 3600,
  timezone: 'Europe/Rome',
  unixtime: 1702673099,
  utc_datetime: '2023-12-15T20:44:59.632338+00:00',
  utc_offset: '+01:00',
  week_number: 50
}

Which wasn't expected by returning schema

dst_from: 'string',
dst_offset: 'number',
dst_until: 'string',

Expected test result after fix approval

20:44:59  W1   log     Europe/Rome - 2023-12-15T21:44:59.632338+01:00

Cause: outdated return schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants